Python Forum
.py to exe error "oserror winerror 193"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.py to exe error "oserror winerror 193"
#1
My search show that this is a common error when trying pyinstaller.

Error:
oserror winerror 193 1 is not a valid win32 application
Something about conflicting versions of Python... I think. I'm not sure if it my editor "Thonny" that is the problem, or my Python3, or my windows OS.

Is it that my windows is 32 bit, and my python3 is the 64 bit version? or visa versa? I don't really even know what that means so I wanted to check if anyone here doesn't before I start uninstalling and reinstalling stuff (incorrectly).
Reply
#2
Look as this Thread it can help.
You need to figure out what's the main version in Environment Variables Path.
Thonny comes with own build in Python version for ease of use,but you can also use python.org version.

Do this from command line(cmd)
# Test python
C:\>python -c "import sys; print(sys.executable)"
C:\python37\python.exe

# Test pip
C:\>pip -V
pip 19.3.1 from c:\python37\lib\site-packages\pip (python 3.7)

# Where is pyinstaller
C:\>where pyinstaller
C:\Python37\Scripts\pyinstaller.exe
C:\Python38\Scripts\pyinstaller.exe

C:\>
So my main version is Windows Path is Python 3.7,so if i do this.
C:\>pyinstaller --onefile some.py
It will use Python 3.7,this is same all folder in cmd as it's main version in Path.
If i go into C:\Python38\Scripts\ folder and do the same it will pyinstaller(not work yet 3.8) with Python 3.8.

Can have may version i have lot,just need to understand how Windows see this and have one main version.
py can be used to assess all standard versions version.
E:\div_code
λ py -0
Installed Pythons found by py Launcher for Windows
 -3.8-32 *
 -3.7-32
 -3.6-32
 -3.5-32
 -3.4-32
 -2.7-32
Quote:Is it that my windows is 32 bit, and my python3 is the 64 bit version?
If you start python from command line(cmd) you will see if Python version is 32-bit or 64-bit.
[MSC v.1916 32 bit (Intel)] --> 32-bit 
[MSC v.1915 64 bit (AMD64)] --> 64-bit
Reply
#3
My progress:

I didn't have pip installed correctly, now I do.
My windows 10 in 64 bit
My python3.7.2 is 64 bit



Thonny is running a "bundled" python that is 32 bit. I changed the internal to run the same version as the one in my path. Pyinstaller gets same error.

From Idle my game gets pygame error.
Error:
Traceback (most recent call last): File "C:\Users\owner\Desktop\Python3\Space_Shooter\Main.py", line 1, in <module> import pygame File "C:\Users\owner\AppData\Roaming\Python\Python37\site-packages\pygame\__init__.py", line 136, in <module> from pygame.base import * ModuleNotFoundError: No module named 'pygame.base'
Already had done:
C:\Users\owner\AppData\Local\Programs\Python\Python37>pip install pygame
Requirement already satisfied: pygame in c:\users\owner\appdata\roaming\python\python37\site-packages (1.9.4)


I'm going to have to write something that takes no imports and see if it converts to .exe.
Reply
#4
So... I uninstalled python and pycharm and thonny. Then I reinstalled python3.7.2 (64bit), pip, pygame, and pyinstaller.

My programs run in IDLE, but I get the exact error from pyinstaller about a 32 bit application... of which I'm not using one.

I'd really like to be able to send things to people. Is there something more I can try? Is there an alternate method to convert .py to exe?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  OSError occurs in Linux. anna17 2 191 Mar-23-2024, 10:00 PM
Last Post: snippsat
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,496 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  OSError with SMPT script Milan 0 693 Apr-28-2023, 01:34 PM
Last Post: Milan
  OSERROR When mkdir Oshadha 4 1,660 Jun-29-2022, 08:50 AM
Last Post: DeaD_EyE
  WinError 2, since fresh new Windows 10 install alok 1 1,612 Jan-06-2022, 11:20 PM
Last Post: lucasbazan
  OSError: Unable to load libjvm when connecting to hdfs with pyarrow 3.0.0 aupres 0 3,101 Mar-22-2021, 10:25 AM
Last Post: aupres
  pyarrow throws oserror winerror 193 1 is not a valid win32 application aupres 2 3,733 Oct-21-2020, 01:04 AM
Last Post: aupres
  WinError 87 while running .exe file Timych 0 2,329 Aug-06-2020, 02:36 PM
Last Post: Timych
  Sublime Text 3 WinError 2 File Specified HelloWorld17 0 2,782 Apr-02-2020, 09:03 AM
Last Post: HelloWorld17
  OSError: [Errno 26] Text file busy: '/var/tmp/tmp5qbeydbp batchenr 1 4,165 Mar-20-2020, 01:58 PM
Last Post: ibreeden

Forum Jump:

User Panel Messages

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