EmuGUI
EmuGUI copied to clipboard
using username to get home folder is a bad idea
reference to #80 I have a little different problem
E:\EmuGUI> emugui.exe
E:\EmuGUI\_internal\services\pathfinder.pyc
E:\EmuGUI\
2025-04-20
EmuGUI 2.0.10.5621
Current date: 2025-03-08
OS: Windows 11 or later, Version 10.0.26100
CPU: 12x AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD @3.22 GHz (AMD64)
RAM: 16487870464 bytes (15.36 GB)
Python: 3.12.9 tags/v3.12.9, compiled with MSC v.1942 64 bit (AMD64)
Traceback (most recent call last):
File "errors\logman.py", line 36, in writeToLogFile
with open(self.logFile, "a+") as logger:
^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\base_13\\Documents\\EmuGUI\\log-ymbzz6al1s6m9koj5qrkkk36dvenk9zq.txt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "emugui.py", line 3768, in <module>
win = Window()
^^^^^^^^
File "emugui.py", line 171, in __init__
logman.writeToLogFile(f"{errors.errCodes.errCodes[38]}: Running EmuGUI {self.version}")
File "errors\logman.py", line 42, in writeToLogFile
platformSpecific.windowsSpecific.windowsCreEmuGUIFolder()
File "platformSpecific\windowsSpecific.py", line 68, in windowsCreEmuGUIFolder
os.mkdir(f"C:\\Users\\{userName}\\Documents\\EmuGUI")
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\base_13\\Documents\\EmuGUI'
[PYI-15756:ERROR] Failed to execute script 'emugui' due to unhandled exception!
E:\EmuGUI> 1 11:46:54
well my Documents folder doesn't exist on my home instead it exist on my secondary drive
also my home isn't C:\Users\base_13 its different because I changed username so getting username to get home isn't a great idea, instead you should use things like platformdirs which get exact path using registries
>>> import platformdirs
>>> platformdirs.user_documents_dir()
'D:\\Documents'
>>> platformdirs.user_documents_path()
WindowsPath('D:/Documents')
>>> import os
>>> os.listdir(fr'C:\Users\{os.getlogin()}')
Traceback (most recent call last):
File "<python-input-7>", line 1, in <module>
os.listdir(fr'C:\Users\{os.getlogin()}')
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\base_13'
This looks like something I might have fixed in EmuGUI 2.1. Can you please look at that?
This looks like something I might have fixed in EmuGUI 2.1. Can you please look at that?
its still there in https://github.com/Tech-FZ/EmuGUI/blob/main/platformSpecific/windowsSpecific.py
also I recommend using pathlib it will be easier to manage paths with it... its a standard lib so you don't have to install it
EmuGUI 2.1 is in the Pre-Release repository. You have looked at the stable one again.