msg333147 - (view) |
Author: (MaximilianSP) |
Date: 2019-01-07 12:47 |
Whenever startupinfo is called, python crashes on my Computer. I have added the file showing the error traceback. I have seen a few bug Reports related to startupinfo on Windows. Not sure what the issue is and I hope you can help me. I am running the python code via spyder. My apologies if this is not the forum for these Kind of questions. |
|
|
msg333153 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2019-01-07 14:36 |
The screenshot says "OSError: [WinError 87] Falscher Parameter" at Lib/subprocess.py:1178 which is this call: hp, ht, pid, tid = _winapi.CreateProcess(executable, args, # no special security None, None, int(not close_fds), creationflags, env, os.fspath(cwd) if cwd is not None else None, startupinfo) According to the traceback, the call is: subprocess.check_output([execStr,"-3",self.geofile,"-o",self.vtkFile]) Can you please dump these parameters? Are they all strings? IMHO execStr, self.geofile or self.vtkFile is not a valid string and it's a bug in your code. Context: * bpo-34044 * commit 29be3bd3c9aed0190e60096a603120cacda82375 * Comments on the commit: https://github.com/python/cpython/commit/29be3bd3c9aed0190e60096a603120cacda82375#commitcomment-31855236 |
|
|
msg333154 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2019-01-07 14:38 |
"Issue with execute_child in startupinfo" I don't think that the issue is related to startupinfo at all, since you don't specify this parameter in your check_output() call. Python shows you "startupinfo)" in the traceback because the function call takes multiple lines in the source code. This issue is not a crash: it's possible to catch the exception and continue the execution. |
|
|
msg333174 - (view) |
Author: (MaximilianSP) |
Date: 2019-01-07 16:26 |
Thank you for the input Victor. I will need a little time to dig in the code and check the attributes. I am fairly new to python :) You are right that the code doesn't crash. Just I cannot continue with the following steps. That is why I thought it crashed. |
|
|
msg333333 - (view) |
Author: (MaximilianSP) |
Date: 2019-01-09 16:59 |
Hello Victor, a new version of the code has been released and I now get another error. I will mark the issue as resolved. Thank you for the quick response! |
|
|
msg333334 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2019-01-09 17:05 |
Ok, you're welcome ;-) |
|
|
msg337165 - (view) |
Author: Geoff Alexander (Geoff.Alexander) |
Date: 2019-03-05 03:14 |
I've recently hit this problem (or one that has the same symptoms): ``` Traceback (most recent call last): File "migration.py", line 169, in migrate() File "migration.py", line 80, in migrate rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\rtcFunctions.py", line 310, in acceptchangesintoworkspace Commiter.addandcommit(changeEntry) File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\gitFunctions.py", line 97, in addandcommit Commiter.handle_captitalization_filename_changes() File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\gitFunctions.py", line 130, in handle_captitalization_filename_changes files = shell.getoutput("git ls-files") File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\shell.py", line 33, in getoutput outputasbytestring = check_output(command, shell=True) File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 356, in check_output **kwargs).stdout File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 423, in run with Popen(*popenargs, **kwargs) as process: File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 1017, in _execute_child startupinfo) OSError: [WinError 87] The parameter is incorrect ``` I've tried Python 3.7.2 32-bit, 3.7.2 64-bit, and 3.6.8 64-bit on Windows 10. The error occurs in a long running Python script after more than one and half hours. The subprocess.check_output call at shell.py:33 is successfully called hundreds, probably thousands, of times before failing. I see that the issue is reported as resolved. But I'm not understanding what is meant by ``` a new version of the code has been released ``` I'm running the latest version of Python, Python 3.7.2, from https://www.python.org/downloads/windows/ (as well as the previous version 3.6.8). Is there a later version of Python I can try? Or do I need to get a newer version of the Python subprocess module? I'm new to Python and wasn't sure if I should reopen this issue or create a new issue. Please let me know if there any additional information I can collect to help debug this problem. |
|
|
msg337166 - (view) |
Author: Geoff Alexander (Geoff.Alexander) |
Date: 2019-03-05 04:01 |
Here's the trace back I get from Python 3.7.2: Traceback (most recent call last): File "migration.py", line 169, in migrate() File "migration.py", line 80, in migrate rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\rtcFunctions.py", line 310, in acceptchangesintoworkspace Commiter.addandcommit(changeEntry) File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\gitFunctions.py", line 97, in addandcommit Commiter.handle_captitalization_filename_changes() File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\gitFunctions.py", line 130, in handle_captitalization_filename_changes files = shell.getoutput("git ls-files") File "c:\Users\GeoffAlexander\Documents\Nirvana\RTC2Git\git-repositories\rtc2git-migration-tool\shell.py", line 33, in getoutput outputasbytestring = check_output(command, shell=True) File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 395, in check_output **kwargs).stdout File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 472, in run with Popen(*popenargs, **kwargs) as process: File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "C:\Users\GeoffAlexander\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child startupinfo) OSError: [WinError 87] The parameter is incorrect |
|
|
msg337171 - (view) |
Author: Eryk Sun (eryksun) *  |
Date: 2019-03-05 08:24 |
Geoff, we probably need a new issue for this, but first, please report the value of len(os.getcwd()) in a case where check_output() fails. Prior to Windows 10, the working directory is limited to MAX_PATH - 2 (258) characters. (Windows uses the last two characters internally for a trailing backslash and a terminating null.) However, even with long-path support enabled in Windows 10, CreateProcessW retains the original WINAPI limit, which I assume is because the current implementation doesn't know whether the child supports long paths. If the inherited current directory exceeds this limit, CreateProcessW fails with ERROR_INVALID_PARAMETER (87). |
|
|
msg337180 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2019-03-05 11:29 |
> Geoff, we probably need a new issue for this, Yes please, this issue is closed. > Prior to Windows 10, the working directory is limited to MAX_PATH - 2 (258) characters. (...) CreateProcessW fails with ERROR_INVALID_PARAMETER (87). Geoff: for your bug report, please dump len(os.getcwd()) as Eryk asked, but try also to dump all arguments passed to CreateProcess, or at least arguments passed to subprocess. |
|
|
msg337308 - (view) |
Author: Geoff Alexander (Geoff.Alexander) |
Date: 2019-03-06 14:43 |
The [WinError 87] does seems to be caused by the current directory's name being too long. The value of len(os.getcwd())is 260 when the exception occurs. The failing call was subprocess.check_output("git ls-files", shell=True). I've open Issue 36213 to track this problem. |
|
|