KernelWanderers / OCSysInfo

Basic, high-level and efficient CLI for discovering, outputting and parsing hardware information from the current system.
MIT License
94 stars 14 forks source link

Failure to open application #22

Closed chiyakiha closed 2 years ago

chiyakiha commented 2 years ago

The application appears to be failing to open due to dependency-related issues, which I have been able to replicate on two devices (both running Windows 11) with version 1.0.2 (versions 1.0.0 and 1.0.1 can launch properly on both devices).

The two failures appear to be originating from the src\util\missing_dep.py file (it's not fully clear to me if there may be something going on elsewhere). The error on 1.0.2 (from Releases) states

Traceback (most recent call last):
  File "main.py", line 5, in <module>
ModuleNotFoundError: No module named 'src.util.missing_dep'
[38048] Failed to execute script 'main' due to unhandled exception!

and an error from a self-built executable (built from bd74915b54c4eca3b9b9cd99b095c2449efc8845) stating

 Package "requests" is not installed!
Package "dicttoxml" is not installed!
Package "distro" is not installed!
Package "xmltodict" is not installed!
Package "wmi" is not installed!
Package "pywin32" is not installed!

Do you wish to install the aforementioned missing packages? [y/n]: n
Exited successfully.
Traceback (most recent call last):
  File "main.py", line 22, in <module>
  File "util\missing_dep.py", line 52, in install_reqs
NameError: name 'exit' is not defined
[27728] Failed to execute script 'main' due to unhandled exception!

I have self-built the application using the same configuration used in Actions (Build Windows binaries), shown below: https://github.com/kernelBPD/OCSysInfo/blob/bd74915b54c4eca3b9b9cd99b095c2449efc8845/.github/workflows/release.yml#L59-L63

*I am able to run/debug main.py via PyCharm, building from origin/main (commit at this time bd74915b54c4eca3b9b9cd99b095c2449efc8845). I believe there may be an issue with the release pipeline that is causing this issue to occur.

If any more information is required, I will provide it in this thread.

kernel-dev commented 2 years ago

Thank you for opening this issue, I wasn't aware of this until very recently.

So, first off:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
ModuleNotFoundError: No module named 'src.util.missing_dep'
[38048] Failed to execute script 'main' due to unhandled exception!

This was caused by a conflict with main files; I accidentally overwrote the main.py file on the releases-source branch with a modified file from the main branch. In the main branch, the main.py ensures that the user has installed all the necessary dependencies, and prompts them if not. This is because, if ran as a regular python script, and not from a binary, there is a chance of the user not installing all required dependencies.

^ Fixed in 81cd3c7

Next issue:

Package "requests" is not installed!
Package "dicttoxml" is not installed!
Package "distro" is not installed!
Package "xmltodict" is not installed!
Package "wmi" is not installed!
Package "pywin32" is not installed!

Do you wish to install the aforementioned missing packages? [y/n]: n
Exited successfully.
Traceback (most recent call last):
 File "main.py", line 22, in <module>
 File "util\missing_dep.py", line 52, in install_reqs
NameError: name 'exit' is not defined
[27728] Failed to execute script 'main' due to unhandled exception!

This could possibly be a mere Python interpreter bug? If you're running the script via: python /path/to/OCSysInfo/main.py - it should work properly. However, I've ran across this issue when using pyinstaller (I will assume that you've also used this), the origin of this issue is foreign to me, however, I have found a solution: merely import the exit function from the sys package.

^ Should be fixed in f4d9f3d5 (at least for binary releases)

I've also made a new binary release, if you wish to test that. All the aforementioned bugs should be fixed.

CC: Releases

chiyakiha commented 2 years ago

This was caused by a conflict with main files; I accidentally overwrote the main.py file on the releases-source branch with a modified file from the main branch.

I did not notice the releases-source branch when looking, so the conflict between it and main does make sense on that front.

This is because, if ran as a regular python script, and not from a binary, there is a chance of the user not installing all required dependencies.

Right, this case is what initially made me believe that the binary release wasn't configured properly (I work with .NET mainly, which allows for Release/Debug configurations by default)

However, I've ran across this issue when using pyinstaller (I will assume that you've also used this), the origin of this issue is foreign to me

I had made use of the Build Windows binaries portion of .github/workflows/release.yml to build to a binary, not run directly from the code, particularly the lines below: https://github.com/kernelBPD/OCSysInfo/blob/bd74915b54c4eca3b9b9cd99b095c2449efc8845/.github/workflows/release.yml#L56-L63

My build log (Command Prompt, PyCharm Community 2022.1 EAP) is listed below. Perhaps your build process on Actions may differ from what I'm doing on my side.

View more ```cs (venv) C:\Users\admin\Documents\dev\OCSysInfo>pip3 install -r requirements.txt Ignoring pyobjc: markers 'python_version >= "3.8" and sys_platform == "darwin"' don't match your environment Requirement already satisfied: requests in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from -r requirements.txt (line 2)) (2.27.1) Requirement already satisfied: dicttoxml in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from -r requirements.txt (line 3)) (1.7.4) Requirement already satisfied: distro in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from -r requirements.txt (line 4)) (1.7.0) Requirement already satisfied: xmltodict in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from -r requirements.txt (line 5)) (0.12.0) Requirement already satisfied: wmi in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from -r requirements.txt (line 11)) (1.5.1) Requirement already satisfied: pywin32 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from -r requirements.txt (line 12)) (303) Requirement already satisfied: idna<4,>=2.5 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from requests->-r requirements.txt (line 2)) (3.3) Requirement already satisfied: certifi>=2017.4.17 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from requests->-r requirements.txt (line 2)) (2021.10.8) Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from requests->-r requirements.txt (line 2)) (2.0.12) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from requests->-r requirements.txt (line 2)) (1.26.9) WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available. You should consider upgrading via the 'C:\Users\admin\Documents\dev\OCSysInfo\venv\Scripts\python.exe -m pip install --upgrade pip' command. (venv) C:\Users\admin\Documents\dev\OCSysInfo>pip3 install pyinstaller Requirement already satisfied: pyinstaller in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (4.10) Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from pyinstaller) (0.2.0) Requirement already satisfied: altgraph in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from pyinstaller) (0.17.2) Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from pyinstaller) (2022.3) Requirement already satisfied: setuptools in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from pyinstaller) (60.2.0) Requirement already satisfied: pefile>=2017.8.1 in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from pyinstaller) (2021.9.3) Requirement already satisfied: future in c:\users\admin\documents\dev\ocsysinfo\venv\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2) WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available. You should consider upgrading via the 'C:\Users\admin\Documents\dev\OCSysInfo\venv\Scripts\python.exe -m pip install --upgrade pip' command. (venv) C:\Users\admin\Documents\dev\OCSysInfo>pyinstaller main.py --onefile --name ocsysinfo_win --paths=./src 156 INFO: PyInstaller: 4.10 156 INFO: Python: 3.10.2 162 INFO: Platform: Windows-10-10.0.22581-SP0 163 INFO: wrote C:\Users\admin\Documents\dev\OCSysInfo\ocsysinfo_win.spec 164 INFO: UPX is not available. 169 INFO: Extending PYTHONPATH with paths ['C:\\Users\\admin\\Documents\\dev\\OCSysInfo', 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\src'] 337 INFO: checking Analysis 338 INFO: Building Analysis because Analysis-00.toc is non existent 338 INFO: Initializing module dependency graph... 339 INFO: Caching module graph hooks... 353 INFO: Analyzing base_library.zip ... 3245 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'. 3246 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib' 4815 INFO: Caching module dependency graph... 4926 INFO: running Analysis Analysis-00.toc 4928 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe 4976 INFO: Analyzing C:\Users\admin\Documents\dev\OCSysInfo\main.py 5090 INFO: Processing pre-find module path hook site from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'. 5091 INFO: site: retargeting to fake-dir 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\fake-modules' 5765 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'. 6541 INFO: Processing pre-safe import module hook win32com from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'. 6971 INFO: Processing module hooks... 6971 INFO: Loading module hook 'hook-certifi.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'... 6975 INFO: Loading module hook 'hook-pythoncom.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'... 7152 INFO: Loading module hook 'hook-pywintypes.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'... 7327 INFO: Loading module hook 'hook-win32com.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'... 7356 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7358 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7358 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7359 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7422 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7423 INFO: Loading module hook 'hook-lib2to3.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7449 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7450 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7451 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7818 WARNING: Hidden import "pkg_resources.py2_warn" not found! 7818 WARNING: Hidden import "pkg_resources.markers" not found! 7819 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7820 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7944 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7944 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7945 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 7945 INFO: Loading module hook 'hook-_tkinter.py' from 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks'... 8108 INFO: checking Tree 8108 INFO: Building Tree because Tree-00.toc is non existent 8108 INFO: Building Tree Tree-00.toc 8158 INFO: checking Tree 8158 INFO: Building Tree because Tree-01.toc is non existent 8159 INFO: Building Tree Tree-01.toc 8227 INFO: checking Tree 8227 INFO: Building Tree because Tree-02.toc is non existent 8227 INFO: Building Tree Tree-02.toc 8245 INFO: Looking for ctypes DLLs 8263 INFO: Analyzing run-time hooks ... 8265 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py' 8266 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py' 8267 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py' 8269 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py' 8271 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32api.py' 8271 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32comgenpy.py' 8272 INFO: Including run-time hook 'C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py' 8278 INFO: Looking for dynamic libraries 8607 INFO: Looking for eggs 8607 INFO: Using Python library C:\Users\admin\AppData\Local\Programs\Python\Python310\python310.dll 8607 INFO: Found binding redirects: [] 8610 INFO: Warnings written to C:\Users\admin\Documents\dev\OCSysInfo\build\ocsysinfo_win\warn-ocsysinfo_win.txt 8651 INFO: Graph cross-reference written to C:\Users\admin\Documents\dev\OCSysInfo\build\ocsysinfo_win\xref-ocsysinfo_win.html 8661 INFO: checking PYZ 8661 INFO: Building PYZ because PYZ-00.toc is non existent 8662 INFO: Building PYZ (ZlibArchive) C:\Users\admin\Documents\dev\OCSysInfo\build\ocsysinfo_win\PYZ-00.pyz 9161 INFO: Building PYZ (ZlibArchive) C:\Users\admin\Documents\dev\OCSysInfo\build\ocsysinfo_win\PYZ-00.pyz completed successfully. 9172 INFO: checking PKG 9172 INFO: Building PKG because PKG-00.toc is non existent 9172 INFO: Building PKG (CArchive) ocsysinfo_win.pkg 11277 INFO: Building PKG (CArchive) ocsysinfo_win.pkg completed successfully. 11279 INFO: Bootloader C:\Users\admin\Documents\dev\OCSysInfo\venv\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe 11279 INFO: checking EXE 11279 INFO: Building EXE because EXE-00.toc is non existent 11279 INFO: Building EXE from EXE-00.toc 11279 INFO: Copying bootloader EXE to C:\Users\admin\Documents\dev\OCSysInfo\dist\ocsysinfo_win.exe.notanexecutable 11364 INFO: Copying icon to EXE 11364 INFO: Copying icons from ['C:\\Users\\admin\\Documents\\dev\\OCSysInfo\\venv\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico'] 11413 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes 11413 INFO: Writing RT_ICON 1 resource with 3752 bytes 11413 INFO: Writing RT_ICON 2 resource with 2216 bytes 11413 INFO: Writing RT_ICON 3 resource with 1384 bytes 11413 INFO: Writing RT_ICON 4 resource with 37019 bytes 11413 INFO: Writing RT_ICON 5 resource with 9640 bytes 11413 INFO: Writing RT_ICON 6 resource with 4264 bytes 11413 INFO: Writing RT_ICON 7 resource with 1128 bytes 11415 INFO: Copying 0 resources to EXE 11415 INFO: Emedding manifest in EXE 11415 INFO: Updating manifest in C:\Users\admin\Documents\dev\OCSysInfo\dist\ocsysinfo_win.exe.notanexecutable 11463 INFO: Updating resource type 24 name 1 language 0 11464 INFO: Appending PKG archive to EXE 14621 INFO: Building EXE from EXE-00.toc completed successfully. ```

I've also made a new binary release, if you wish to test that. All the aforementioned bugs should be fixed.

Testing binary release 1.0.3, it appears to be working normally. Since the main issue appears to be fixed now, I'll go ahead and close this. Thanks for your time!