Strangeness: Cannot write to a file from a process created by WindowsTask Scheduler ...

S

Sandy Walsh

Hi there,

Seeing some really weird behavior and perhaps someone has seen something
similar:

I have a python script that launches as a Windows Scheduled Task. The
program simply opens a disk file and writes some text to it:

---
f = open("waiting.txt", "w")
x = 0
while 1:
f.write("Sleeping: %d\r\n" % x)
x += 1
time.sleep(2)

f.close()
---

I've run it under my user account. I've run it as Local Account. I've
run it via pythonw and python ... only one way works:

When I run with full credentials (not local account) and python (not
pythonw) I get output in the file (and a CMD window appears while it's
running). In every other combination it creates the 'waiting.txt' file,
but doesn't write any output to the file. The length of the file is 0 bytes.

Anyone have ideas what could be causing this? I suspect it's blocking on
something, but I can't imagine where.

There is no stderr/stdout output anywhere in the program so it's not
blocking on anything stdio related (that I can imagine)

Thoughts?
-Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top