Search code examples
python-2.7cx-freezexlwings

Error with cx_Freeze and xlwings as standalone version with fibonacci tutorial


When I compile the example fibonacci from xlwings as a standalone version, I get the following error upon execution. I have tried to include files using the include_files option in the cx_Freeze setup script but I keep getting the error.

Has someone any idea on how to correct that problem ?

Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in     <module>
  File "ioforge.py", line 10, in <module>

  File "C:\Anaconda\lib\site-packages\xlwings-0.3.0-py2.7.egg\xlwings\__init__.py",     line 18, in <module>
  File "C:\Anaconda\lib\site-packages\xlwings-0.3.0-py2.7.egg\xlwings\_xlwindows.py",     line 9, in <module>
WindowsError: [Error 123] Syntaxe du nom de fichier, de répertoire ou de volume     incorrecte: ''

The line on which is the problem is as below :

# Hack to find pythoncom.dll - needed for some distribution/setups
# E.g. if python is started with the full path outside of the python path, then it almost     certainly fails
cwd = os.getcwd()
os.chdir(sys.exec_prefix)
import win32api
os.chdir(cwd)

Solution

  • It complains that it doesn't find your directories. Try to uninstall/reinstall xlwings completely (if necessary check in the Anaconda\Lib\site-packages folder. xlwings-0.3.0-py2.7.egg is usually called xlwings-0.3.0-py2.7.egg-info so not sure if that is the reason it doesn't find it.