Unable to find version.dll with PY2 and PyInstaller

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to find version.dll with PY2 and PyInstaller

Nico Zanferrari
Hi,

I'm facing a strange error on Windows - I hope you can help me ;-)

With python 2.7.16 64 bit, I can build one-folder binaries for the web2py framework but when I run it I get the error:

Traceback (most recent call last):
 
File "web2py.py", line 21, in <module>
 
File "C:\Users\nico\Desktop\web2py_win\web2py\gluon\widget.py", line 23, in <module>
   
from gluon import main, newcron
 
File "C:\Users\nico\Desktop\web2py_win\web2py\gluon\main.py", line 114, in <module>
   
from gluon import rocket
 
File "C:\Users\nico\Desktop\web2py_win\web2py\gluon\rocket.py", line 26, in <module>
    IS_JYTHON
= platform.system() == 'Java'  # Handle special cases for Jython
 
File "platform.py", line 1265, in system
 
File "platform.py", line 1161, in uname
 
File "platform.py", line 637, in win32_ver
 
File "platform.py", line 593, in _get_real_winver
 
File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 174, in __init__
__main__
.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\nico\\Desktop\\WEB2PY~1\\web2py\\version'. Most probably this dynlib/dll was not found when the application was frozen.
[3776] Failed to execute script web2py




Hence, it seems that the error comes from the official python module platform.py that cannot find the Windows's version.dll file. This DLL is obviously present on C:\windows\system32 (Win 10 64 bit) and I cannot embed it in the binary.

Note that I have no problem with PY3, and the error disappears if I copy the DLL in the binary dir. 

Also, a simple test with:

import platform
IS_JYTHON
= platform.system() == 'Java'  
if IS_JYTHON == True:
   
print('IS_JYTHON is True')
elif IS_JYTHON == False:
   
print('IS_JYTHON is False')
else:
   
print('IS_JYTHON is Unknown')


compiles and runs without any problem. As a workaround, I have forced 'IS_JYTHON = False' on rocket.py in order to skip the error but it's not so elegant.


What's wrong and what can I do?


Thank you,
Nico





--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to find version.dll with PY2 and PyInstaller

Nico Zanferrari
Hi all,

I have already resolved the problem: it's quite strange, but the only reason is the presence of a file named 'VERSION' in the folder of the app!

With PY2 and PyInstaller, it sems that this file is used by python instead of the system's version.dll in order to check for Window's version. The simple test worked because it didn't have the VERSION file.

So, the solution is to rename this file ;-)

Cheers,
Nico  

Il giorno sab 27 apr 2019 alle ore 09:33 Nico Zanferrari <[hidden email]> ha scritto:
Hi,

I'm facing a strange error on Windows - I hope you can help me ;-)

With python 2.7.16 64 bit, I can build one-folder binaries for the web2py framework but when I run it I get the error:

Traceback (most recent call last):
 
File "web2py.py", line 21, in <module>
 
File "C:\Users\nico\Desktop\web2py_win\web2py\gluon\widget.py", line 23, in <module>
   
from gluon import main, newcron
 
File "C:\Users\nico\Desktop\web2py_win\web2py\gluon\main.py", line 114, in <module>
   
from gluon import rocket
 
File "C:\Users\nico\Desktop\web2py_win\web2py\gluon\rocket.py", line 26, in <module>
    IS_JYTHON
= platform.system() == 'Java'  # Handle special cases for Jython
 
File "platform.py", line 1265, in system
 
File "platform.py", line 1161, in uname
 
File "platform.py", line 637, in win32_ver
 
File "platform.py", line 593, in _get_real_winver
 
File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 174, in __init__
__main__
.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\nico\\Desktop\\WEB2PY~1\\web2py\\version'. Most probably this dynlib/dll was not found when the application was frozen.
[3776] Failed to execute script web2py




Hence, it seems that the error comes from the official python module platform.py that cannot find the Windows's version.dll file. This DLL is obviously present on C:\windows\system32 (Win 10 64 bit) and I cannot embed it in the binary.

Note that I have no problem with PY3, and the error disappears if I copy the DLL in the binary dir. 

Also, a simple test with:

import platform
IS_JYTHON
= platform.system() == 'Java'  
if IS_JYTHON == True:
   
print('IS_JYTHON is True')
elif IS_JYTHON == False:
   
print('IS_JYTHON is False')
else:
   
print('IS_JYTHON is Unknown')


compiles and runs without any problem. As a workaround, I have forced 'IS_JYTHON = False' on rocket.py in order to skip the error but it's not so elegant.


What's wrong and what can I do?


Thank you,
Nico





--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.