Solved the issue, by injecting the query into the cmd line. Shell script worked fine as if I was cutting and pasting to the prompt. Seems to still be something with the subprocess receiving and exit code before or when the query finishes, just when I ask to to read from the .SQL file.
example called from in python: mysql .... < file.txt > out.txt <---- doesn't work (query is run 0Byte output) mysql .... -e "my query" > out.txt <----- does work However this isn't standard mysql as it's infinidb. Maybe this is an esoteric issue. Thanks for the help Oscar. Frustrating since it seems illogical.... seems if the cmd runs in the shell it should have the exact same behavior from a subprocess shell=True cmd string call. If I find anything else I'll update this. -- http://mail.python.org/mailman/listinfo/python-list