subprocess.Popen() suddenly giving me grief?

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>python3
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.Popen(['Z:/depot/kJams/Scripting/AutoPin.exe', 'parameter'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\", line 1456, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 50] The request is not supported

this was working recently. this is on Windows 10 with all latest OS updates

problem may have started after recent OS update?

What kind of device is your Z: drive?

it is a network mapped drive. but i have added it to the local intranet zone

Was this network mapped drive, and the Python code, previously being used on the same computer?

A bit of searching around suggests that this error (from Windows) might be something to do with trying to launch a 32-bit executable on a 64-bit platform or vice-versa.

it was previously in a Parallels VM where the host machine was serving up the network mapped Z drive, via the Parallels driver, but now the Z drive is hosted on a different machine. I figured it would make no difference, except for allowing Z in the local intranet

i launched a 32bit command line (from vs 2008) tried the same thing and same problem.
this was working literally just 2 days ago. only difference is the new drive and a software update

If you try using the exact same code to invoke something that’s local to your C: drive, does it work? Would be an easy way to see whether it’s the network drive that’s causing issues.

you’re right, it DID work when run from a local drive.
this is vexing

Okay, that’s definitely of interest. Sorry though: I’ve just come to the end of my knowledge of Windows limitations. So I’ll have to let someone else figure out exactly WHY a network drive causes you grief here.

when i move the AutoPin.exe to an internal drive, it DOES work. so it has something to do with the fact that it’s on a network-mapped drive. but see my screen shot where you can see that i EXPLICITLY allow running apps from that drive

After a little research, I guess It is a problem about “Mapped Device”
The exception is caused by “_winapi.CreateProcess” that is a windows system call.

it says “Mapped drives are per session” and maybe just the python is just out of user session .
Maybe, you can try “UNC path” or use a true file system like “NFS”

1 Like

you’re correct. using UNC paths fixes the problem.

separately, another viable fix is to use the EnableLinkedConnections registry key, which is what i did on my system.

1 Like