__VERSION__ = open(path.join(path.dirname(__file__), 'version.txt')).read().strip()
and the corresponding file in C:\Python27\Lib\site-packages\xlrd\version.txt
with "0.7.6" as the only content, now my program fails after freeze with this error:
Traceback (most recent call last):
File
"c:\gestion_financiera\build\pyi.win32\gestion_financiera\outPYZ1.pyz/mainwindow",
line 230, in on_action_Empresas_del_grupo_triggered
File "C:\pyinstaller-1.5\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5\iu.py", line 521, in doimport
exec co in mod.__dict__
File
"c:\gestion_financiera\build\pyi.win32\gestion_financiera\outPYZ1.pyz/empresa_grupo_widget",
line 6, in <module>
File "C:\pyinstaller-1.5\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5\iu.py", line 521, in doimport
exec co in mod.__dict__
File
"c:\gestion_financiera\build\pyi.win32\gestion_financiera\outPYZ1.pyz/xlrd",
line 5, in <module>
IOError
[Errno 2] No such file or directory:
'c:\\gestion_financiera\\build\\pyi.win32\\gestion_financiera\\outPYZ1.pyz\\version.txt'
I have collected datafiles before but i don't know how to collect a file and put
it inside the outPYZ1.pyz archive, and i am not sure that putting directly there
a file with a common name like "version.txt" would be a good idea anyway, i
suppose i should be doing anything else.
In the meantime i have changed the xlrd __init__.py to '__VERSION__ = "0.7.6"'
but don't seems to me like a good idea keep modifying modules sources to get my
application freeze correctly.
What should i do? Thanks.
Regards,
Miguel Angel.
This will simply not work with a frozen app. Please see the manual for
hot to adopt for being frozen.
> I have collected datafiles before but i don't know how to collect a file and put
> it inside the outPYZ1.pyz archive, and i am not sure that putting directly there
> a file with a common name like "version.txt" would be a good idea anyway, i
> suppose i should be doing anything else.
Even if you'd add the file to the PYZ, the line above will not work:
open() can not open content within an archive (no matter if PYZ or zip
or something else).
> What should i do? Thanks.
Best solution is to contact the author so he will change his code. (IMHO
Reading the version number from an external file is no good idea anyway.)
--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP
Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de
Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de