mteillet / PyVexr

Python open Exr Viewer
MIT License
5 stars 0 forks source link

Relative path issue on terminal opening. #1

Closed MrLixm closed 1 year ago

MrLixm commented 1 year ago

Hello !

Context

I am using the latest alpha build v0.0.3 on Windows 10.

Issue

The application crash before being open because of an invalid relative path :

C:\Users\lcoll>F:\softwares\apps\pyvexr\0.0.3\dist\pyVexr_gui.exe                                                       
qt.qpa.fonts: Unable to enumerate family ' "Segoe UI Variable Static Display" '                                         
qt.qpa.fonts: Unable to enumerate family ' "Segoe UI Variable Static Display" '                                         
Traceback (most recent call last):                                                                                        
  File "pyVexr_gui.py", line 2043, in <module>                                                                            
  File "pyVexr_gui.py", line 1268, in updateImgDict                                                                       
  File "pyVexr_gui.py", line 933, in loadFile                                                                             
  File "pyVexr_main.py", line 123, in loadImg                                                                             
  File "pyVexr_main.py", line 407, in convertExr                                                                          
  File "pyVexr_main.py", line 375, in checkFirstExrChannel                                                              
OSError: Cannot read image file "imgs/pyVexrSplashScreen_v001.exr". No such file or directory.                          
[17604] Failed to execute script 'pyVexr_gui' due to unhandled exception!                                                                                                                        

Steps to reproduce

Expected behaviour

I assume the application doesn't the working directory to be set to the directory of the .exe. When starting from the command line it's not the case (set to C:\Users\lcoll) so the application crash.

Probably all relative paths should be produced from a "root path" which is himself built relative to the path of the executable ?


Hope it's clear. Cheers !

mteillet commented 1 year ago

Hi :)

I think you're right about the issue expected behaviour. I'll add a root path system in order to avoid it in the next release, thank you for this elaborate feedback :)

mteillet commented 1 year ago

Hi again,

Fixed using absolute paths and the os.path.dirname(sys.argv[0]) method The latest windows release has been updated with the fix : https://github.com/mteillet/PyVexr/releases/tag/v0.0.3-Alpha-Windows Thank's for the feedback ! 😄

Martin