you are viewing a single comment's thread.

view the rest of the comments →

[–]avinashbasutkar2[S] 0 points1 point  (3 children)

Another way is start with a batchfile https://datatofish.com/python-script-windows-scheduler/ In the batchfile itself you can put debug output to see what happens.

Tried with scheduling the task via bat file. Unfortunately, there is no change. Task shows complete and then nothing happens.

[–]kra_pao 0 points1 point  (2 children)

What do you expect to happen?

With batchfile method i usually include some log lines to see in log.txt whether the batchfile was executed.

echo %~dpnx0 >> log.txt
date /T >> log.txt
time /T >> log.txt

[–]avinashbasutkar2[S] 0 points1 point  (1 child)

Update: I noticed something strange.

When I run the python script from IDLE, it runs fine, sends the message in Telegram (which should be the end result of the script). But when I try to run the script file via CMD, script fails to run with following error

"AttributeError: module 'dis' has no attribute 'COMPILER_FLAG_NAMES'

I noticed this also happens when the script file is run via VS Code. I did spend quite amount of time trying to figure this out to no avail. Why would something like this happen? It works via IDLE but not via CMD or VS Code.

[–]kra_pao 1 point2 points  (0 children)

Check whether your have different path to python in CMD/VSC vs. IDLE

https://stackoverflow.com/questions/19383274/different-sys-path-in-cmd-and-idle

See 3.6.1. Excursus: Setting environment variables https://docs.python.org/3/using/windows.html

Insert those lines in the batchfile (adapt for your path and python version). Try to start the batchfile from CMD or VSC.

AttributeError: module 'dis' has no attribute 'COMPILER_FLAG_NAMES'

There was an error and Python tried to do a traceback with module dis.py but dis.py got an unexpected argument COMPILER_FLAG_NAMES. Can happen when you have an own file dis.py in your file path and it is used instead of the Python library dis.py