Platform detection on macOS: 'win' in 'darwin' in sys.platform
Issue #237
new
In utilities.py
, line 288:
if 'win' in sys.platform: # True on macOS where sys.platform=='darwin'
...
...
log(' detected Windows platform')... # wrong behavior
On macOS where sys.platform='darwin'
, 'win' in sys.platform
returns True
, so pexpect.popen_spawn.PopenSpawn
` instead of pexpect.spawn
is used to open processes, which may be bad.
In my personal experience (macOS 12.4, amp-atomistics 1.0, pexpect 4.8.0), Python throws TIMEOUT: <pexpect.popen_spawn.PopenSpawn
` after the log file logs Starting local connections
. But if I manually substitute the line with if 'win' in sys.platform and 'darwin' not in sys.platform
, the computation proceeds normally.
Comments (1)
-
repo owner - Log in to comment
Thanks for reporting. Maybe we should be detecting with
platform.system()
instead ofsys.platform
? See this link. I only have linux so am not sure how to check.Better than checking platforms might be to do a
try ... except
loop? If it’s due to a simple change in import location, we could do something like:Of course, the above doesn’t work if both commands exist in both places. (Both import lines do work on linux.)
Perhaps a windows user can chime in? Those lines of code were written by @ericmusa, who could perhaps suggest if the above will work.