1

Here is what I have:

process = subprocess.Popen(["cmd.exe",
                            "/c"
                            "appcfg.py",
                            "upload_data",
                            "--config_file=..\\bulkloader.yaml",
                            "--filename=" + generateXmlFilename(kind),
                            "--kind=" + kind,
                            "--url=" + getTargetGaeUrl(),
                            "--application=" + getTargetGaeApplication(),
                            "--email=example@gmail.com",
                            "../"])

This works as expected, however, when I introduce "--passin" I can't seem to get it into stdin correctly. I have tried the following:

file = open("upload.pass")
process = subprocess.Popen([..., "--passin"], stdin=file)

as well as

process.stdin.write("myPassword")

and I have even tried (in a shot in the dark)

process = subprocess.Popen([..., "--passin", "< upload.pass"])

You might have noticed I am trying to do this on a Windows 7 machine.

Is this possible?

Update:

After posting this and reading it in a different format, I realized that I wasn't waiting on the process.

The solution is:

file = open("upload.pass")
process = subprocess.Popen([..., "--passin"], stdin=file)
process.wait()

That works perfectly. I am assuming since I wasn't waiting python wasn't injecting anything into the subprocess because I had already exited.

2 Answers2

1

After posting this and reading it in a different format, I realized that I wasn't waiting on the process.

The solution is:

file = open("upload.pass")
process = subprocess.Popen([..., "--passin"], stdin=file)
process.wait()

That works perfectly. I am assuming since I wasn't waiting python wasn't injecting anything into the subprocess because I had already exited.

0

If you find yourself adding code to handle auth, errors, and so on, you might also want to consider gaedriver as a library to use appcfg: http://code.google.com/p/gaedriver/

schuppe
  • 2,033
  • 10
  • 10