"Unable to create process" error

Hello, i’m quite a newbie to Python myself and i’m trying to progress in this but can’t seem to make it work. I’m trying to use a MediaFire folder scraper (mf-dl) to download multiple files simultaneously. Everything has run fine up to the point i’m right now - installation is ok, PATH is set, requirements and pip were already run.

But when i get to executing the .py command i need i get a “Unable to create process using ‘C:\bin\env py mfdl.py output links.csv’: System could not find file.” error.

I’m actually a bit unsure on what this means. It seems like it is trying to run or execute the command from a C:\bin\env folder which does not exist, but i am inside the designated folder i want to use [plus, i have executed pip inside the same folder]. What does seem to be the problem here, and how can i progress from here?

env is a unix program not a windows one. Are you following instructions for Linux system by any chance?

Try with a command line like this:

py.exe mfdl.py output links.csv

The script “mfdl.py” has an unusual shebang command, “#!/bin/env”. We support “#!/usr/bin/env” virtual shebangs in the py launcher on Windows, which is the normal path that’s used for the “env” program. You can open an issue to support “#!/bin/env” virtual shebangs in the new launcher that’s distributed with Python 3.11 and later.

As a workaround, edit “mfdl.py” to change it to use either “#!/usr/bin/env python3” or “#!/usr/bin/python3”.

That won’t help. The py launcher mishandles the shebang line in “mfdl.py”.

Would this stop py.exe looking at the shebang?

py.exe -3 script.py

Yes, using -3 should skip reading the shebang. However, one won’t be able to run the script from PATH. I assume “mfdl.py” isn’t located in the current directory that contains “links.csv” and where the “output” directory is created, so it would have to be run as py -3 "full\path\to\mfdl.py" output links.csv. It’s probably simpler in general to just modify the shebang to be able to run mfdl output links.csv.

Agreed. I have never seen #!/bin/env used as far as I can recall.

I used to have a portability issue with env on some older systems; I’m
pretty sure I have had to hand add a /usr/bin/env symlink on some
older systems where env was only in /bin.

Personally, I’d advocate for supporting both - seems trivial, even if
such systems are now very rare.

Cheers,
Cameron Simpson cs@cskk.id.au