Running Python (Windows) with _spawnvp requires unexpected quotesaround arguments
Tim Peters
tim.one at comcast.net
Sun Oct 26 12:37:57 EST 2003
More information about the Python-list mailing list
Sun Oct 26 12:37:57 EST 2003
- Previous message (by thread): Running Python (Windows) with _spawnvp requires unexpected quotes around arguments
- Next message (by thread): PyPy: sprint and news
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Elmar Krieger] > The _spawnvp function expects the command line arguments as a NULL > terminated list of char * pointers, That's true. > hence there is no need to enclose filenames with quotes if they > contain spaces. But that's not true, on Windows. The Microsoft implementation of the spawn functions uses the Win32 CreateProcess(), which doesn't take an array of arguments -- it takes a pointer to a single command line string. The MS implementation pastes all the arguments into that single string before calling CreateProcess(), replacing the terminating NUL character in each argument with a single blank (except the last argument, whose terminating NUL is left alone, and so serves as the terminating NUL character of the command line string). CreateProcess() in turn then can't tell the difference between a blank inserted by a spawn function and a blank originally present in one of your arguments. > However, if I run pythonw.exe with _spawnvp, and the Python script to > execute (that's the second command line parameter) has spaces in the > pathname, it only works if the pathname is enclosed with quotes. > Is that OK? That is how it works.
- Previous message (by thread): Running Python (Windows) with _spawnvp requires unexpected quotes around arguments
- Next message (by thread): PyPy: sprint and news
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list