4

I am trying to schedule a python script which has been converted to .exe file but for some reason it is not starting. Although the program does seem to open a cmd type window but the script does not work. Below i have outlined the steps which i took, please advise if i have missed something here.

The executable does produce results when I double click on it.

enter image description here Next enter image description here enter image description here enter image description here enter image description here enter image description here

Edit:

I was able to locate the file after running a search where it is saving the output. The executable python is in desktop but for some reason it is saving the output of the executable in system 32 folder in c:. Why is it doing that? Since if i double click on the python executable which is on the desktop it would create a folder and files inside there but the scheduler is saving it in system 32.

3
  • have you solve your problem ? Commented May 2, 2020 at 20:35
  • @AliHasanAhmedKhan Not i still have the same problem! Commented May 3, 2020 at 2:00
  • Have you tried my solution? Commented May 3, 2020 at 11:21

1 Answer 1

2

It should be one of these:

  1. The task from the task scheduler may not run from the same account as you might expect. Consider running it as root/administrator account.
  2. Consider generating the pyinstaller executable with the --uac-admin which will allow you to run the executable as the administrator

You could also debug the problem by piping the output to a file which will allow you to see the error message.

Sign up to request clarification or add additional context in comments.

9 Comments

Could you please advise how can i pipe the output to a file? I should mention that the executable works when i double click on the file.
You could make a bat file with the contents exec.exe > output.txt and run the bat file from the scheduler
The output.txt was created, but in a different directory. In the scheduled task you indicate the path of the executable file, but not the path of the data file! Specify a full path for it. I.e.: @echo off & START C:\Users\inderjeet\Desktop\python.exe > C:\Users\inderjeet\Desktop\output.txt
@newcoder. Keep the file in a common location outside the Users directory. Create a C:\tmp with full permissions to everyone and see if it can run from there?
@newcoder are you building with -w/--windowed/--noconsole? If so, build without it. Then repeat and see if you get the output.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.