Hi Werner and all,
Thanks the reply. I will look into using GUI2EXE, I think where GUI2EXE
works and my setup script doesn't is because GUI2EXE will send an option to
include this DLL file.
It seems to me that py2exe definitely needs this msvcr80.dll file, so I
pasted it into the root of my script that I was compiling. This made it
compile with no errors. Woo hoo! (Or so I thought...)
However, another problem (which I think is the reason why the msvcr80.dll is
needed) is that when I run the application, it errors on code related to not
being able to use a required pyd file. Specifically, this is a _chilkat.pyd
file.
Here's my console script I'm trying to compile:
import chilkat
import sys
#extract a rar archive
rar = chilkat.CkRar()
success = rar.Open('file.rar')
if (success != True):
print 'could not open file'
print rar.lastErrorText()
success = rar.Unrar("") #unrar to curDir
if (success != True):
print 'could not extract'
x = raw_input('done')
The chilkat library for python 2.6 can be found here:
http://www.chilkatsoft.com/download/chilkatPython26.zip
Here's the begg. of the chilkat.py module:
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
try:
fp, pathname, description = imp.find_module('_chilkat',
[dirname(__file__)])
_mod = imp.load_module('_chilkat', fp, pathname, description)
finally:
if fp is not None: fp.close()
return _mod
_chilkat = swig_import_helper()
del swig_import_helper
else:
import _chilkat
del version_info
As you can see it relies on another file to be present in the root, which is
the _chilkat.pyd file.
When I compile my script, I can find the _chilkat.pyd and chilkat.py file
in the /collect-26/ build directory. It looks like py2e is finding it?
When I run the compiled script, I get errors:
Traceback (most recent call last):
File "extract_file.py", line 1, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "C:\scripts\g\ChilkatPython26\chilkatPython26\chilkat.py", line 19,
in <module>
_chilkat = swig_import_helper()
File "C:\scripts\g\ChilkatPython26\chilkatPython26\chilkat.py", line 17,
in swig_import_helper
if fp is not None: fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
Traceback (most recent call last):
File "extract_file.py", line 1, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "C:\scripts\g\ChilkatPython26\chilkatPython26\chilkat.py", line 19,
in <module>
_chilkat = swig_import_helper()
File "C:\scripts\g\ChilkatPython26\chilkatPython26\chilkat.py", line 17,
in swig_import_helper
if fp is not None: fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
Traceback (most recent call last):
File "extract_file.py", line 1, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "C:\scripts\g\ChilkatPython26\chilkatPython26\chilkat.py", line 19,
in <module>
_chilkat = swig_import_helper()
File "C:\scripts\g\ChilkatPython26\chilkatPython26\chilkat.py", line 17,
in swig_import_helper
if fp is not None: fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
So what do you think is going on here?
My hunch is that py2exe did not properly put _chilkat.pyd where's it
supposed to go in order for the script to utilize it, since these errors
related to _chilkat.pyd or chilkat.py.
Is there a way to give py2exe in the setup script a location for required
PYD files?
Thanks for the help everyone.
On Sat, Aug 28, 2010 at 6:47 AM, Werner F. Bruhin <werner.bruhin@...:
> On 27/08/2010 20:49, Mark Swalaski wrote:
> > Hi, I'm having trouble compiling my console script on windows 7 on
> > python 2.6
> > Here is my setup script:
> >
> > |from distutils.coreimport setup
> >
> > import py2exe,sys,os
> >
> > sys.argv.append('py2exe')
> >
> >
> > try:
> > setup(
> > options= {'py2exe': {'bundle_files': 1}},
> >
> > console=['my_console_script.py'],
> > zipfile= None,
> >
> > )
> > except Exception, e:
> >
> > print e
> >
> >
> > *this will error with this message:*
> > ||> running py2exe
> >> *** searchingfor required modules***
> >
> >> *** parsing results***
> >> *** finding dlls needed*** Traceback (most recent calllast):
> File
> >
> >> "C:\scripts\download_ghost_recon\setup.py",
> >> line26, in <module>
> >
> >> zipfile= None, File "C:\Python26\lib\distutils\core.py",
> >
> >> line162, in setup
> >> raise SystemExit, errorSystemExit: error: MSVCR80.dll: No
> >
> >> such fileor directory|
> >
> >
> >
> > I did a search on my computer for this file, here are the locations
> > where it is found:
> >
> >
> |C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.762_none_10b2f55f9bffb8f8
> >
> >
> C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4053_none_d08d7da0442a985d
> >
> >
> C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_d08a205e442db5b5
> >
> >
> >
> >
> > My goal is to create a single executable to run my program, no other dlls
> or files to distribute along with it.
> > I couldn't find an answer to this problem on your wiki or on the
> internet...
> > However, I did find this wiki page about including dlls:
> >
> > |http://www.py2exe.org/index.cgi/OverridingCriteraForIncludingDlls
> >
> > |
> > So I then tried this code, but it also didn't work:
> >
> > ||from distutils.coreimport setup
> > import py2exe,sys,os
> >
> >
> > origIsSystemDLL= py2exe.build_exe.isSystemDLL
> > def isSystemDLL(pathname):
> >
> > if os.path.basename(pathname).lower() in ("msvcp71.dll",
> "dwmapi.dll"):
> >
> > return 0
> > return origIsSystemDLL(pathname)
> >
> > py2exe.build_exe.isSystemDLL= isSystemDLL
> >
> > sys.argv.append('py2exe')
> >
> >
> > try:
> > setup(
> > options= {'py2exe': {'bundle_files': 1}},
> >
> > console=['my_console_script.py'],
> > zipfile= None,
> >
> > )
> > except Exception, e:
> >
> > print e|
> >
> >
> >
> >
> >
> >
> >
> > Any help on successfully compiling my script would be appreciated! :)
> Thank you.
> Haven't had much success with bundle option 1, instead of trying to get
> to a single file this way I use InnoSetup to distribute a single file
> and it installs then my py2exe generated application with all the stuff
> it needs.
>
> A sample setup.py and InnoSetup script is giving here:
> http://wiki.wxpython.org/Deployment
>
> Werner
>
>
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> Py2exe-users mailing list
> Py2exe-users@...
> https://lists.sourceforge.net/lists/listinfo/py2exe-users
>
|