Why does my python script run forever on windows task scheduler?

So this daily python script has been running fine since 2010 but recently the service accnt's pwd was changed and since then it stopped working. Or it runs but runs forever, with no result. This script just transfers iis log files from a different server to the one where it runs.
What I have tried so far.
1. Added the service accnt to the "Log on as a batch job" security policy.
2. edited the script to move a single log file locally
3. created a batch file and included "start C:\Python27\python.exe D:\scripts\fix_thomas_logs - edited.py". Ran the batch file, which completed and few seconds with the message Task Scheduler successfully completed task "\WebTrends\TestPythonBat" , instance "{3685c79f-925d-43dc-8520-3e6eb6f92a58}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 0. But still no output.

Is this a permissions issue? im asking this because the script stopped working since the pwd of the service accnt was changed. The scheduler is running other vbscripts and batch files as well but this is the only python script.
Please Help.
Nidhi VarmaDeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peprCommented:
You should add some debugging info written to the dedicated file to find the reason. Check the code parts wrapped to the try/except construct. Simplify gradually the script to the point when you fond what part of the script is problematic.
0
Nidhi VarmaDeveloperAuthor Commented:
Hi,

I've already added the debug or try/except section to the code and that  doesn't help either. It does not give any output and keeps running until I kill the task. When I tried running through a batch file, it runs for less than a second and completes but again with no output.
0
peprCommented:
I do not know your script. I am not that good in guessing.
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

aikimarkCommented:
Did you change the authentication credentials of the scheduled task?
Is the id/password part of your Python script?
0
Walter RitzelSenior Software EngineerCommented:
I'll ask you some questions:
1) What is the copy file command being used?
2) Since you had an error on the script, have you checked if there is space on the target folder? Also have you cleaned up the files that should be copied from source to target on target, and repeat the operation?

I'm asking this because I'm suspecting that maybe your copy command is missing a force flag or something like that, and your script got stucked in a OS question like "do you want to overwrite the file xxxx?"
0
Nidhi VarmaDeveloperAuthor Commented:
Resolved it, The issue was with the windows task scheduler that could not run the .py script. I ran the script through command prompt and it worked fine. I had to change the settings in the scheduler to run python .exe and give the  the .py script in the argument.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peprCommented:
If you feel my comment is rude, then sorry, but it is your own feeling. For me, it is simply difficult to guess when I do not know your script. And that's it.
0
Nidhi VarmaDeveloperAuthor Commented:
I have selected my own comment as a solution because I did not get a timely or accurate response from the experts. Rather got a rude comment from the first guy.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.