#๐ win32gui not installing
171 messages ยท Page 1 of 1 (latest)
@native pond
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
i did
C:\Users\Taylon>py -m pip install pywin32
Collecting pywin32
Using cached pywin32-308-cp313-cp313-win_amd64.whl.metadata (8.3 kB)
Using cached pywin32-308-cp313-cp313-win_amd64.whl (6.5 MB)
Installing collected packages: pywin32
Successfully installed pywin32-308
Python Script Running
C:\Users\Taylon>
Traceback (most recent call last):
File "C:\Users\Taylon\Downloads\main.py", line 3, in <module>
import win32gui
ModuleNotFoundError: No module named 'win32gui'
@thorn sand
How are you running the script?
Okay, and what happens if you use from win32 import win32gui
its not working, but it working on mine im sharing this code to a friend
isnt there a way to put the modules in a folder?
and then share that
@thorn sand
You can use pyinstaller to bundle it yeah
how do i do that
PS C:\Users\littl\Downloads> pyinstaller main.py
pyinstaller : The term 'pyinstaller' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- pyinstaller main.py
-
+ CategoryInfo : ObjectNotFound: (pyinstaller:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Try py -m pyinstaller
PS C:\Users\littl\Downloads> py -m pyinstaller main.py
C:\Users\littl\AppData\Local\Programs\Python\Python311\python.exe: No module named pyinstaller
i just downloaded it
If you run py -m pip install pyinstaller what's the output?
PS C:\Users\littl\Downloads> py -m pip install pyinstaller
Requirement already satisfied: pyinstaller in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (6.11.1)
Requirement already satisfied: setuptools>=42.0.0 in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (from pyinstaller) (75.3.0)
Requirement already satisfied: altgraph in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (from pyinstaller) (0.17.4)
Requirement already satisfied: pyinstaller-hooks-contrib>=2024.9 in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (from pyinstaller) (2024.9)
Requirement already satisfied: packaging>=22.0 in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (from pyinstaller) (24.1)
Requirement already satisfied: pefile!=2024.8.26,>=2022.5.30 in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (from pyinstaller) (2023.2.7)
Requirement already satisfied: pywin32-ctypes>=0.2.1 in c:\users\littl\appdata\local\programs\python\python311\lib\site-packages (from pyinstaller) (0.2.3)```
Huh okay, looks like a PATH error
pip on its own never works btw
i always have to do py -m
ยป pathlib
ยป relative-path
ยป windows-path
no
https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command
3rd answer from top, follow thoes steps
I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date...
well thats great
dw i got it
i just do windows + r
right
3.11
Click System
brings up settings -> about
In the windows search bar type "edit environment" and click the option that says "edit environment options"
Environment variables
yes
Try pyinstaller now
okay its doing stuff
after its done
do i just send him the file
yep
It'll give an executable
With the modules, interpreter and script bundles
Windows defender may flag it, that's a false positive
yes okay
can i move the exe location?
as my script wont work now
as i use file locations#
Yep
and now the file isnt in the same foler
I'd use the --onefile option
how
pyinstaller --onefile script.py
okay ill redo
okay done
now
i have a disk and a build
do i ned both of them folders?
you don't need any folders, just the .exe made with onefile
Ahh okay
yo @thorn sand so in the file i find a json file inside the folder
but now it doesnt work
how do i fix?
self.config_path = os.path.join(os.path.dirname(__file__), "config.json")
File not found
it closes to fast
but it says file not found
its looking in some temp folder
in app data
Run the exe from a command primpt
how
main.exe : The term 'main.exe' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- main.exe
-
+ CategoryInfo : ObjectNotFound: (main.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command main.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\main.exe". See "get-help about_Command_Precedence" for more details.
Type .\main.exe
Traceback (most recent call last):
File "main.py", line 22, in load_config
raise FileNotFoundError(f"Configuration file not found: {self.config_path}")
FileNotFoundError: Configuration file not found: C:\Users\littl\AppData\Local\Temp\_MEI101122\config.json
[PYI-10492:ERROR] Failed to execute script 'main' due to unhandled exception!```
right ok
any idea?
ok ill remake exe now?
aye
also btw
when you say do "json"
or whatever
what if there is a folder
bc i have two
and one is inside a folder
Well you'd put the folder name there
File not found: folder\usernames.txt
"folder\usernames.txt"
oh you have extra files that you reference?
are they all in one folder?
okay for the ones inside just do
if that makes sense
folder -> main.exe
folder -> config.json
folder -> folder -> txt
File "C:\Users\littl\Downloads\main.py", line 13
self.file_path = "folder\usernames.txt"
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 14-15: truncated \uXXXX escape
thats why u need double slash
but then it dont work
/ not \
like?
I'm not really sure, never used it and I don't know what your friends python environment is like
shit and new ๐คฃ
@thorn sand is there a way to manually download it?
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.