3

I encounter the following error when freezing an app with esky. This occurs when using py2exe as the freezer module.

error: c:\docume~1\user\locals~1\temp\tmpkizl0t\scripts\my_script.py:
The process cannot access the file because it is being used by another process

The error only occurs when I use the sympy module in my code and add it to the packages in my setup.py file. Here is the "options" part of my setup.py file:

options = {
           'bdist_esky': {"freezer_module":"py2exe",
              'includes':['encodings','Symbolic','matplotlib','Sequence','ClientTCP',
                          'XMLSequenceParser','XMLSequenceWriter','utils.widgets',
                          'pylab','ConfigParser','numpy','xml.etree.ElementTree','logging',
                          're','json','pylab','socket','struct','threading','traceback',
                          'utils.liststore','Reporter','tempfile', 'filecmp','os',  
                          'cairo', 'pango', 'pangocairo', 'atk', 'gobject', 'gio','matplotlib.backends.backend_qt4agg','sympy'],
              }
          },

Problem below solved by answer from Thomas K:

If I use cx_freeze as the freezer module then the build completes but when I try to run the executable I get a similar error:

Traceback (most recent call last):
File "cx_Freeze__init__.py", line 743, in <module>
File "cx_Freeze__init__.py", line 332, in bootstrap
File "cx_Freeze__init__.py", line 359, in chainload
File "cx_Freeze__init__.py", line 729, in _chainload
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
exec code in m.__dict__
File "c:\docume~1\user\locals~1\temp\tmpyisdxd\scripts\my_script.py", line 1447,
in <module>
NameError: name '__file__' is not defined

Has anyone come across this problem?

Celt
  • 31
  • 2
  • I don't think you can use `__file__` in frozen applications, because it's not actually running from a script file. – Thomas K Sep 20 '13 at 02:38
  • Thanks Thomas, this is the answer to the problem when using cx_freeze as the freezer module. The error when using py2exe remains, but at least I can freeze it with cx_freeze. – Celt Sep 20 '13 at 12:48

1 Answers1

0

The error seems to indicate that some other process is using one of the SymPy files. Maybe just restarting the computer will fix it?

asmeurer
  • 86,894
  • 26
  • 169
  • 240
  • Thanks for the suggestion but restarting does not help. I've also tried using a different computer, with the same result. – Celt Sep 20 '13 at 12:18