From: Sharma, G. <gir...@wu...> - 2016-03-09 01:34:31
|
Hi Kloth, I think I understand what you mean. Could you please specify where should I add >if 0: > import datetime There are three options: 1. setup.py file 2. mainscript.py file (I have just one file) 3. somewhere else (in some .py file in library) Also, where exactly in the file. In the beginning of the imports or somewhere else? ________________________________________ From: Jeremy Kloth <jer...@gm...> Sent: Tuesday, March 8, 2016 6:37 PM To: Sharma, Girish Cc: py2...@li... Subject: Re: [Py2exe-users] .exe file working on my computer but not other computers On Tue, Mar 8, 2016 at 11:22 AM, Sharma, Girish <gir...@wu...> wrote: > Dear Massa, > > I understood what you are saying. Thank you for explaining it more clearly > to a newbie. > > To analyse the problem: > - read the file numpy\core\multiarray.py > - check which file is imported in line 10 > > But, > I could not find numpy\core\multiarray.py file in > C:\Anaconda2\Lib\site-packages\numpy\core. Though I found multiarray.pyd > file which I cannot open and see. multiarray.py is a stub file generated by py2exe for loading multiarray.pyd. It will not be found in the normal Python module locations. > which makes your error message rather suspicious. Anyway, multiarray.pyd is > probably the binary file that is missing. Actually, in this case it is a module that is imported *by* multiarray that is missing. > Have you checked if it is copied into the build directory? > > > Build directory has numpy\core\multiarray.pyc file. > Dist directory has numpy\core\multiarray.pyd file. > > import sys > import numpy.core > import numpy.core.mutliarray > As I alluded to above, the multiarray module does imports in C which py2exe cannot discover. The missing import is 'datetime' from the Python standard library. The "trick" used for adding missing modules to py2exe-generated executables is to add an: if 0: import missing_module_1 import missing_module_2 to the main executable that is scanned by the py2exe setup.py. For you, it should be sufficient to add "import datetime" to the forced import block: if 0: import datetime and regenerate the executable. -- Jeremy Kloth |