Python Forum

Full Version: [WinError 193] %1 is not a valid Win32 application
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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 :-)
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
try running the program from a command line/terminal.
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.
(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?
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?
(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.
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
(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?
@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
Pages: 1 2