1

I'm trying to freeze a Python application and Celery, packaged up with esky for update capabilities. I need Celery to be frozen so that it has visibility into the modules from the first executable that will also be present in the library.zip file that py2exe creates.

The problem is that I cannot get Celery to freeze with esky. Here's a bare minimum, stripped down setup.py file that I'm using to try and find a solution around the problem:

from esky import bdist_esky
from distutils.core import setup

setup(name='ColdCelery',
      scripts=['C:\\Python27\\Lib\\site-packages\\celery\\bin\\celery.py'],
      options = {
          'bdist_esky':{
              'freezer_module': 'py2exe',
          }
      }
)

When I run the following command:

python setup.py bdist_esky

I get the following error:

running bdist_esky
running build_scripts
*** searching for required modules *** 
error: c:\temp\tmpz5146o\scripts\celery.py: The process cannot access the file
because it is being used by another process

There is no running Python process on the machine that could be using Celery. I assume this is a conflict between py2exe and esky, but don't know how to overcome it.

I can freeze Celery using py2exe without referencing esky without a problem, but I will require being able to update this project in the future, so esky support is a must.

3 Answers3

0

I had problems running py2exe and esky in the tutorial

I use cx freeze in my project and i haven't had any problems.

It also supports python3, linux and mac so i can recommend giving it a go.

http://cx-freeze.readthedocs.org/en/latest/

timeyyy
  • 654
  • 9
  • 20
0

Ultimately, we did not find the reason for the failures that were occurring, but we did pick up on an important point and we changed our environments to get around the issue.

Our build machine did double duty for development. It's not the best idea of course and it was probably one of the many, many packages installed for that development that was causing trouble.

So we started with a bare bones Windows installation and installed only the minimum number of packages needed to actually perform the build. That seems to have done the trick.

0

I rediscovered our fix for this issue. The error message is misleading - after debugging I found that the actual error was caused by esky adding some lines to the top of celery.py during the packaging operation. These lines were going above a from __future__ import absolute_import, unicode_literals causing the following error:

SyntaxError: from __future__ imports must occur at the beginning of the file

To fix:

Edit C:\Python27\Lib\site-packages\celery\bin\celery.py and strip all comments and empty lines from the top of the file.

Jake Levitt
  • 120
  • 1
  • 9