import win32api results in ImportError:

559 views
Skip to first unread message

Bill Wood

unread,
Dec 17, 2012, 12:43:07 PM12/17/12
to portabl...@googlegroups.com
Simply entering the following commands results in the following import error.  I have install PP on my USB drive, multiple times and on multiple drives.  I have encountered this issue on 2 machines - Win7 and Vista.  Both on latest service packs.
I saw a message on this topic July 11, 2012 in this group - but never saw an answer...
My whole objective is to build a portable lab for testing medical instruments.  I was on plan until this issue was encountered over the weekend.
Is it my sys.path?  Is it my OS PATH var?

Thots?  (a little commentary inserted below, F: being the USB device)

TIA,
BillW

F:\>"\Portable Python 3.2.1.1\App\python.exe"
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'F:\\Portable Python 3.2.1.1\\App\\python32.zip', 'F:\\Portable Python 3.2.
1.1\\App\\DLLs', 'F:\\Portable Python 3.2.1.1\\App\\lib', 'F:\\Portable Python 3
.2.1.1\\App', 'F:\\Portable Python 3.2.1.1\\App\\lib\\site-packages', 'F:\\Porta
ble Python 3.2.1.1\\App\\lib\\site-packages\\win32', 'F:\\Portable Python 3.2.1.
1\\App\\lib\\site-packages\\win32\\lib', 'F:\\Portable Python 3.2.1.1\\App\\lib\
\site-packages\\Pythonwin']
>>> import win32api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
>>> quit()

Here, I show it works inside the App folder, but seems real impractical:

F:\>cd "\Portable Python 3.2.1.1\App"

F:\Portable Python 3.2.1.1\App>.\python.exe
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32api
Worked?!?!
>>> import sys
>>> sys.path
['', 'F:\\Portable Python 3.2.1.1\\App\\python32.zip', 'F:\\Portable Python 3.2.
1.1\\App\\DLLs', 'F:\\Portable Python 3.2.1.1\\App\\lib', 'F:\\Portable Python 3
.2.1.1\\App', 'F:\\Portable Python 3.2.1.1\\App\\lib\\site-packages', 'F:\\Porta
ble Python 3.2.1.1\\App\\lib\\site-packages\\win32', 'F:\\Portable Python 3.2.1.
1\\App\\lib\\site-packages\\win32\\lib', 'F:\\Portable Python 3.2.1.1\\App\\lib\
\site-packages\\Pythonwin']
>>>

Perica Zivkovic

unread,
Dec 23, 2012, 11:30:44 PM12/23/12
to portabl...@googlegroups.com
Bill,

indeed this was reported before but I was unable to reproduce it at that time.

Thank you so much for this detailed bug report, it makes my life much, much easier. Now I can reproduce it and try to figure out what is going wrong !

keep pythoning !

Perica

Perica Zivkovic

unread,
Jan 4, 2013, 12:17:31 AM1/4/13
to portabl...@googlegroups.com
Could you test this Python-Portable executable (attached), it should fix the problem for now, I'm working on a patch release

Just extract in the root of your PP distribution (maybe backup old file just in case you need to revert to it). After that use this portable executable to start python, it will even accept command line parameters if you need to pass some scripts to it.

keep pythoning !

Perica
Python-Portable.zip

Perica Zivkovic

unread,
Jan 12, 2013, 8:09:22 AM1/12/13
to portabl...@googlegroups.com
This issue is resolved in just released Portable Python 2.7.3.2, I'm working on the same fix for 3.2.* release and updating all packages - will be available soon.

Justin Flatt

unread,
Jun 25, 2013, 9:30:01 PM6/25/13
to portabl...@googlegroups.com
Hey Perica,

Has this issue been resolved in 3.2.* yet? I'm having this same issue in 3.2.5.1.

Thanks,

Justin

Perica Zivkovic

unread,
Jul 8, 2013, 3:32:22 PM7/8/13
to portabl...@googlegroups.com
Justin,

this issue has been resolved. Instead of using \App\python.exe please use [PP root folder]\Python-Portable.exe

when you start python interpreter with Python-Portable.exe it should work from any location as this was fixed for both 2.7.* and 3.2.* releases

Let me know if you still experience the issue and post some detailed steps to reproduce.

Nathan McCorkle

unread,
Apr 11, 2014, 7:13:58 PM4/11/14
to portabl...@googlegroups.com
I'm having this issue now too, with a latest release of Portable Python 2.7. Executing Python-Portable.exe from the command prompt doesn't open up an interactive console though, I just get a few blank newlines printed and the command prompt comes back.

Nathan McCorkle

unread,
Apr 11, 2014, 7:17:17 PM4/11/14
to portabl...@googlegroups.com


On Friday, April 11, 2014 4:13:58 PM UTC-7, Nathan McCorkle wrote:
I'm having this issue now too, with a latest release of Portable Python 2.7. Executing Python-Portable.exe from the command prompt doesn't open up an interactive console though, I just get a few blank newlines printed and the command prompt comes back.
 
Oh, I guess the new interpreter just took a while to display. Import seems to work from there.

Hernan Berguan

unread,
Aug 13, 2014, 7:10:52 AM8/13/14
to portabl...@googlegroups.com
Hi,

It seems I'm having this issue when trying to use the wmi module. I'd need to use \App\pythonw.exe to get rid of the console window. Anyway, I've tryed to run my script with [PProot]\Python-Portable.exe and it doesn't seem to avoid the problem.  (using Python 3.2.5).
Then, I've added [PProot]\App to the path and set PYTHONPATH to [PProot]\App. With these settings, the script seems to run happily (with pythonw.exe).
But I'd rather prefer not to set these settings for final users of the script.
I'd appreciate any ideas.
Thanks.
Reply all
Reply to author
Forward
0 new messages