Strange difference between calling command from windows cmd line and from python -


I have a strange behavior during the executable third party management in my Python code. Conceptually I have the following code in Python:

  import subprocess p = subprances Popen ([rc: \ path \ to \ programme.exe ',' -d '], stdout =   

and outside

Code> is returning its traceback, and an error code which means "unchecked exception" with a simple os.system (...)

But here's the fun part, when I paste the command in the window shell, it works perfectly ...

 < Code> C: \> C: \ path \ to \ programme.exe -d  

Python interpreter is 32 bit 2.7.2 version.

..devil What is the difference between these two calls which leads to Tana? Thanks in advance.

Additional Information

I'm not sure if this help But this external device connects to a database and performs some functions. It works with some RDBMS when called by Python code, but when it connects to an Oracle DB, it crashes So the Python code looks correct, only one factor or difference Land that I do not know.

Well, you really do not provide much information I have to deal with situations like this Based on experience, you will guess.

  1. Ensure that the Python application is running as an administrator when you need a third-party app.

  2. Check that there is no problem with the working heart. Meaning, if the program opens some files or in some way it is in the context of some relative path, then you have to change your working directory while executing it from Python. See the code below to do this.

  3. If you are executing the program, then there is a built-in window shell app (dir, copy, etc.). ..) Consider creating Popen objects using shell = True See reference .

  4. Python sets or modifies some environment variables needed / required by your third party application.

  5.   import os oschdir ('/ path_you_need / python / work_from')  

    / div >

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -