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.15k stars 191 forks source link

windows start up error #389

Open Ntonik7 opened 1 year ago

Ntonik7 commented 1 year ago

Describe the bug
I have create Task Scheduler for script and does not run when i log on windows When i run it manual the script run without problem

Environment:

Additional context
Install path for python/pythonw and turing script is C:\

Thanks for your time

mathoudebine commented 1 year ago

Hello, can you check your scheduled task from the task scheduler? It should be setup like this: image image image

Can you also send the content of your log.log file that should be on the main folder?

Ntonik7 commented 1 year ago

Hi, Thanks for your answer

I attach my settings, is in Greek Language(sorry about that) and time zone from log if you need is GMT+2

Screenshot 2023-11-09 155747 Screenshot 2023-11-09 155758 Screenshot 2023-11-09 155811

logs when i run it manually Screenshot 2023-11-09 161531

When i reboot my pc and script dont run from scheduled task log file has not added anything new

Logs from scheduled task Screenshot 2023-11-09 161355

I hope this helps and again thanks for your time

Inquisitor956 commented 6 months ago

Hello, everyone!

This issue of Task Scheduler not launching the Python script at logon has frustrated me for a few hours. I followed every step to the letter and nothing seemed to work.

I did find a workaround, however. It involves pointing Task Scheduler to run a batch file at logon instead. I went this route since I could manually launch my configured script just fine using cmd or PS. This batch file contains a PowerShell command that uses pythonw to run the script. Its very simple and it only involved four lines. The batch file points PowerShell to the directory where you have the python script, then runs it using pythonw, and closes the window automatically after it is done. The window disappears in an instant at logon, so its not intrusive at all IMO.

You can copy and paste this into a .txt file, edit the second line with the directory where you have your script, then save it as a .bat file.

@echo off cd C:\insert_turing_smart_screen_directory_here (ex. C:\turing-smart-screen-python-3.4.0) powershell -NoProfile -Command "Start-Process pythonw.exe -ArgumentList 'main.py' -NoNewWindow" exit

Configure task scheduler as the wiki instructs, except you select the batch file as the 'program' instead of pythonw.exe. Leave the "Add arguments" and "Run in" fields blank, as the batch file takes care of those. Make sure to still select "Run with highest privileges" or else it will not work! See attached screenshots as examples.

1 2 3 4 5 6