का उपयोग करते समय विफल रहता है मेरे पास कुछ पायथन कोड है जो इसे चलाने के लिए python.exe का उपयोग करते समय सही तरीके से काम करता है, लेकिन अगर मैं pythonw.exe का उपयोग करता हूं तो विफल रहता है।पायथन subprocess.call() pythonw.exe
def runStuff(commandLine): outputFileName = 'somefile.txt' outputFile = open(outputFileName, "w") try: result = subprocess.call(commandLine, shell=True, stdout=outputFile) except: print 'Exception thrown:', str(sys.exc_info()[1]) myThread = threading.Thread(None, target=runStuff, commandLine=['whatever...']) myThread.start()
संदेश मैं मिलता है:
Exception thrown: [Error 6] The handle is invalid
हालांकि, अगर मैं 'stdout' पैरामीटर निर्दिष्ट नहीं करते, subprocess.call() ठीक शुरू होता है।
मैं देख सकता हूं कि pythonw.exe आउटपुट को रीडायरेक्ट कर सकता है, लेकिन मैं नहीं देख सकता कि मुझे एक नए धागे के लिए stdout निर्दिष्ट करने से क्यों अवरुद्ध किया गया है। के रूप में यह एक deamon के रूप में चलाता है क्योंकि pythonw कंसोल सहायता प्रदान नहीं करता है, तो subprocess.call()
के डिफ़ॉल्ट तर्क असफल रहे हैं
मुझे वर्तमान में एक ही समस्या है, मैंने पीईक्यूटी 4 के साथ एक बड़ा आवेदन किया है और मुझे बिना किसी कंसोल के सेलेनियम मिल सकता है। कृपया मुझे बताएं कि इसे कैसे ठीक किया जाए। https://stackoverflow.com/questions/46520823/selenium-dont-work-after-exporting-to-exe-in-windowed-mode-in-pyinstaller –