Hello,

I am having trouble importing python modules on certain machines. On some machines import works, on some not (all machines are Win7 64bit). Python is not installed on any of these machines but used embedded. I tried to analyze the problem but did not succeed so here is what I found.

First I will use the module xlsxwriter to explain the problem but it also happens with python36.zip (when importing for example codecs).

I have a xlsxwriter.egg file which is found by the import mechanism but it cannot be opened.

/Traceback (most recent call last):/

//

/File "Z:\Documents\///myscript/.py", line 1, in <module>/

/import glob, inspect, os, json, base64, xlsxwriter, datetime, string/

/ModuleNotFoundError: No module named 'xlsxwriter'/

When I unzip the egg and create two folders, for code and egg-info, it works, the module is imported. Again, the very same egg file works fine on other machines. Tested on win7 with or without python installed, and freshly setup win7 systems with nothing else installed.

I have the same problem with python36.zip that comes with the embedded package.

When starting python.exe (from https://www.python.org/ftp/python/3.6.1/python-3.6.1-embed-win32.zip) the codecs module cannot be imported and python.exe crashes. All paths are correctly set. When I unzip the python36.zip into the python.exe folder everything works fine.

What I found interesting is that the disk monitor tool (Procmon.exe) shows following detail:

07:59:04,3187854 python.exe 4224 CreateFile C:\Users\hansi\Downloads\python-emb\python36.zip SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 07:59:04,3198189 python.exe 4224 CloseFile C:\Users\hansi\Downloads\python-emb\python36.zip SUCCESS 07:59:04,3205458 python.exe 4224 CreateFile C:\Users\hansi\Downloads\python-emb\python36.zip SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened 07:59:04,3205860 python.exe 4224 QueryInformationVolume C:\Users\hansi\Downloads\python-emb\python36.zip SUCCESS VolumeCreationTime: 05.05.2015 12:28:45, VolumeSerialNumber: 36B5-A026, SupportsObjects: True, VolumeLabel: OS 07:59:04,3206127 python.exe 4224 QueryAllInformationFile C:\Users\hansi\Downloads\python-emb\python36.zip BUFFER OVERFLOW CreationTime: 18.04.2017 06:07:23, LastAccessTime: 18.04.2017 06:07:23, LastWriteTime: 21.03.2017 09:06:10, ChangeTime: 18.04.2017 06:07:23, FileAttributes: N, AllocationSize: 2.228.224, EndOfFile: 2.224.303, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x20000000a9467, EaSize: 0, Access: Read Attributes, Synchronize, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word

The interesting line is the one with QueryAllInformationFile and BUFFER OVERFLOW. On machines where it works the buffer overflow does not happen and the query is done with QueryBasicInformationFile and not QueryInformationVolume. Since QueryInformationVolume is most likely only for folders, maybe there is a problem with that.
Here is the log when it's working:

06:30:39,6650716 python.exe 30176 CreateFile C:\Projects\Python\rt_win32\python36.zip SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened 06:30:39,6652657 python.exe 30176 QueryBasicInformationFile C:\Projects\Python\rt_win32\python36.zip SUCCESS CreationTime: 15.02.2017 13:34:03, LastAccessTime: 15.02.2017 13:34:03, LastWriteTime: 22.12.2016 23:30:40, ChangeTime: 18.04.2017 06:19:36, FileAttributes: A 06:30:39,6673617 python.exe 30176 QueryStandardInformationFile C:\Projects\Python\rt_win32\python36.zip SUCCESS AllocationSize: 2.240.512, EndOfFile: 2.237.601, NumberOfLinks: 1, DeletePending: False, Directory: False

Any help is appreciated!

Thanks,
Herb


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to