Home>
The py file cannot be executed in the task scheduler. 0x2 error

Convert (.ipynb) file created by jupyter lab to (.py) file * 1
I want to execute it periodically * 2 using the task scheduler.

In the time scheduler, after creating the basic task, the following is specified.
C: \ Python39 \ python.exe in the Program/Script (P) field
Add Argument (A) column XXX.py
C: \ Python39 in the Start (T) column

I tried with the above contents, but it seems that the file cannot be found due to a 0x2 error.
I have confirmed that the XXX.py file starts on vscode.

I have a poor understanding because I have just started programming.
I think that the cause is that the task scheduler is not able to find python.exe properly, so I am doing work * 3 through the path.
C: \ Python39 is also newly added in the system tourism variable (S) and the environment variable (U) of #user #.

I was finally able to move it, but the New Year ended without solving this problem. .. ..
If i am familiar with this, please give us your guidance and encouragement.

* 1… Reference URL: https://www.youtube.com/watch?v=iTAgip9aaTY&feature=emb_logo Time: 11: 15 ~
* 2… Reference URL: https://ryota-trade.com/?p=4610
* 3… Reference URL: https://www.youtube.com/watch?v=Cs7friXdqdM Time: 2: 32 ~

Previous execution result "0 x 2"
Confirmed contents

1: Confirmation of python storage (because there were two vers including anaconda)
Enter this code with cmd → py --list-paths
-3.9-64 C: \ Python39 \ python.exe *
-3.8-64 C: \ Users \ User \ anaconda3 \ python.exe
We have confirmed that the default python is C: \ Python39.

2: Confirm execution of py file
I have confirmed that the py file can be started independently with vscode.

  • Answer # 1

    python.exeIs specified with the full path, so it has nothing to do with "passing through the PATH".

    The cause of the error isC: \ Python39 \ XXX.pyIs that there is no.
    XXX.pyLet's specify the absolute path (full path) instead of the relative path.

    Alternatively, in the "Start (T) column",XXX.pyYou may enter the directory where is located.

    for the future reference,
    ・ Let's understand the meaning (purpose) of "passing through PATH".
    ・ Let's understand the meaning of "Start (T) column".

Trends