Python Forum
[WinError 193] %1 is not a valid Win32 application
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WinError 193] %1 is not a valid Win32 application
#1
Hello people,

I am pretty new at working with python and I am encoutering the error as stated in the subject. Full error:
Error:
Traceback (most recent call last):   File "C:\Users\Joan\workspace2\Model\src\main.py", line 6, in <module>     import lib_pct_build_network   File "C:\Users\Joan\workspace2\Model\src\lib_pct_build_network.py", line 4, in <module>     from lib_pct_read_network import *   File "C:\Users\Joan\workspace2\Model\src\lib_pct_read_network.py", line 5, in <module>     PCTr=CDLL("./LibPCTReadNetwork.so")   File "C:\Users\Joan\Anaconda3\lib\ctypes\__init__.py", line 347, in __init__     self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application
I have already googled it and many answers say it is a bit 32bit vs 64bit issue. However I don't know what the problem would be  :huh:

I use a 32bit eclipse with PyDev plugin
I have python 3.5 (32 bits)
Windows 7

Is there anything else that should be 32bits? Any help is appreciated :-)
Reply
#2
What code are you trying to run? Note that Win32 does not indicate you are running 32 bit code, it is just a label indicating you are using a Windows platform
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
try running the program from a command line/terminal.
Recommended Tutorials:
Reply
#4
what exactly do you mean with 32bit code? how can i check how many bits my code is?

for a project i have been provided with a toolbox written in python and i'm trying to import a module from this toolbox (could this toolbox perhaps be 64bits? and if so how can i check?). i have placed all files in the same folder.
Reply
#5
(Oct-17-2016, 09:38 PM)Zest Wrote: what exactly do you mean with 32bit code? how can i check how many bits my code is?

for a project i have been provided with a toolbox written in python and i'm trying to import a module from this toolbox (could this toolbox perhaps be 64bits? and if so how can i check?). i have placed all files in the same folder.

When we ask for your code, it means the Python code you have written.  :)
You say you have a 'toolbox' and you are trying to import a module from it, so at the very least, your code will look like this

import module_name    # This is the name of the module you are trying to import

# Here is you code that you've written to use that module
At this point, do not worry about 32 and 64 bit stuff. Where did you get the 'toolbox' from?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#6
alright well the main class looks like this, nothing special, the toolbox was written and provided by someone I know and it isn't public so I should probably not be sharing that without permission  :-/

import lib_pct_build_network

if __name__ == '__main__':
    pass
is there anything you would like to know/see about the toolbox/library?
Reply
#7
(Oct-17-2016, 08:55 PM)Zest Wrote: I use a 32bit eclipse with PyDev plugin
I have python 3.5 (32 bits)
Windows 7
When say python 3.5 (32 bits) is this trough anaconda?
Quote:File "C:\Users\Joan\Anaconda3\lib\ctypes\__init__.py", line 347, in __init__
Error:
OSError: [WinError 193] %1 is not a valid Win32 application
The error message is because you mixing are 32-bit and 64-bit.
Reply
#8
i ran it in the terminal and a similar error happens:

[Image: d62c64801b849bbe9b5205f1e8dc2620.png]

https://gyazo.com/d62c64801b849bbe9b5205f1e8dc2620

@snippsat, if it says so in the stack (the quote) then it must go through anaconda i think? i checked the python in anaconda and it is 32bits

[Image: 930044477b5180cd65da09922eb4ebbc.png]

https://gyazo.com/930044477b5180cd65da09922eb4ebbc
Reply
#9
(Oct-17-2016, 10:10 PM)Zest Wrote: i ran it in the terminal and a similar error happens:

[Image: d62c64801b849bbe9b5205f1e8dc2620.png]

Usually .so is a lib built under linux with the equivalent in windows a .dll.
Is the person that gave you this "toolbox" running linux?
Recommended Tutorials:
Reply
#10
@metulburr,
ahhh that could be the problem. so i'd just have to convert/recompile it to a .dll file and adjust the modules a bit right?
now i just need to find out how to create the .dll files  :) 

thanks

Quote:Is the person that gave you this "toolbox" running linux?
i don't know, seems probable
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020