There's some code I'd like to use from GitHub on my Windows 10 machine. The error I keep getting is:
AttributeError: module 'os' has no attribute 'fork'
I looked this up and found that Windows doesn't support the os.fork()
call, so I tried looking into ways to get bash on a Windows machine (I might need bash for other scripts in the future). I discovered the Windows Linux Subsystem, and it sounded exactly right for this. I installed WLS1 and got Ubuntu for it from the Microsoft store. Bash seems to work as expected, but this script still throws the same error in bash.
I've found a similar question from a few years ago (how to run python script with os.fork on windows?). The accepted answer recommended running a Linux application on a virtual machine, which I think is exactly what I'm doing (right?). Does anyone know how I can get this script to work? (Btw I know it works bc I've run it before on my Linux machine at work.)
Edit: This might be a symptom of another problem.
I think this means Ubuntu WSL1 is using the Linux path to python:
In Powershell: Get-Command python
gives me C:\Users\myname\AppData\Local\Microsoft...
In Ubuntu: which python
gives me /usr/bin/python3
..
In Powershell, if I try to read the .toml file using wellmap .\wellmap-text.toml
, I get the "not in Path" error (which I've been seeing for a lot of things, as I try to set up my machine, and I'm unfamiliar with the right way of adding things to my Path or if doing so could break something)
wellmap : The term 'wellmap' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ wellmap .\wellmap-text.toml
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (wellmap:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
On the Ubuntu WSL, running wellmap ./wellmap-text.toml
gives me a command not found
error.
..
Because I know the Path to the wellmap.exe, I tried to give Powershell and Ubuntu that Path directly and be super explicit. This is where I get the module 'os' has no attribute 'fork'
error.
In Powershell:
& “C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\wellmap.exe” \Users\myname\Desktop\wellmap-text.toml
And this error:
Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\wellmap.exe_main.py", line 7, in File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\wellmap\plot.py", line 101, in main if os.fork() != 0: AttributeError: module 'os' has no attribute 'fork'
In Ubuntu:
/mnt/c/Users/myname/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0/LocalCache/local-packages/Python39/Scripts/wellmap.exe /mnt/c/Users/myname/Desktop/wellmap-test.toml
And the same error too:
Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\runpy.py", lin e 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\runpy.py", lin e 87, in run_code exec(code, run_globals) File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-package s\Python39\Scripts\wellmap.exe_main.py", line 7, in File "C:\Users\myname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-package s\Python39\site-packages\wellmap\plot.py", line 101, in main if os.fork() != 0: AttributeError: module 'os' has no attribute 'fork'