mathoudebine / turing-smart-screen-python

Unofficial Python system monitor and library for small IPS USB-C displays like Turing Smart Screen or XuanFang
GNU General Public License v3.0
1.1k stars 186 forks source link

Configure.py / main.py cannot be run from another folder #358

Open pingyaru opened 1 year ago

pingyaru commented 1 year ago

Problem
I was trying to make step 4 "Configure system monitor" in the "how to start" guide, but it won't start. I was using C:\Users\Sergey\AppData\Local\Programs\Python\Python311\python.exe "D:\small programs\turing-smart-screen-python-3.3.3\configure.py" command to run configure.py. I also tried to run cmd as and administrator.

Screenshot 2023-10-12 215912

C:\Windows\System32>C:\Users\Sergey\AppData\Local\Programs\Python\Python311\python.exe "D:\small programs\turing-smart-screen-python-3.3.3\configure.py" Traceback (most recent call last): File "D:\small programs\turing-smart-screen-python-3.3.3\configure.py", line 434, in <module> configurator = TuringConfigWindow() ^^^^^^^^^^^^^^^^^^^^ File "D:\small programs\turing-smart-screen-python-3.3.3\configure.py", line 148, in __init__ self.window.iconphoto(True, PhotoImage(file="res/icons/monitor-icon-17865/64.png")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Sergey\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 4125, in __init__ Image.__init__(self, 'photo', name, cnf, master, **kw) File "C:\Users\Sergey\AppData\Local\Programs\Python\Python311\Lib\tkinter\__init__.py", line 4072, in __init__ self.tk.call(('image', 'create', imgtype, name,) + options) _tkinter.TclError: couldn't open "res/icons/monitor-icon-17865/64.png": no such file or directory

I made path to 64.png absolute in configure.py but next it said there was a problem with path to config.yaml. I cound't solve it, so I decided to open an issue

Screenshot 2023-10-12 215947

Environment:

mathoudebine commented 1 year ago

Hi, there is indeed an issue with main.py and configure.py. They have been written to be launched from their own directory, because they search for resources in the current terminal folder.

Until it is fixed, you need first to move inside your Terminal to the folder where you have downloaded the program:

D:
cd "D:\small programs\turing-smart-screen-python-3.3.3\"

then you can run the main.py or configure.py from there:

C:\Users\Sergey\AppData\Local\Programs\Python\Python311\python.exe configure.py
C:\Users\Sergey\AppData\Local\Programs\Python\Python311\python.exe main.py
pingyaru commented 1 year ago

Hi, there is indeed an issue with main.py and configure.py. They have been written to be launched from their own directory, because they search for resources in the current terminal folder.

Until it is fixed, you need first to move inside your Terminal to the folder where you have downloaded the program:

D:
cd "D:\small programs\turing-smart-screen-python-3.3.3\"

then you can run the main.py or configure.py from there:

C:\Users\Sergey\AppData\Local\Programs\Python\Python311\python.exe configure.py
C:\Users\Sergey\AppData\Local\Programs\Python\Python311\python.exe main.py

It worked! Thank you very much!