radical-cybertools / radical.utils

Utility classes and tools for various radical projects
Other
8 stars 6 forks source link

On windows, failing to import `os.fork` #406

Closed xylar closed 6 months ago

xylar commented 6 months ago

In our CI on conda-forge, when we try to use the latest release under Windows, we see:

import: 'radical.gtod'
Traceback (most recent call last):
  File "D:\bld\radical.gtod_1715454527932\test_tmp\run_test.py", line 2, in <module>
    import radical.gtod
  File "D:\bld\radical.gtod_1715454527932\_test_env\Lib\site-packages\radical\gtod\__init__.py", line 9, in <module>
    import radical.utils as _ru
  File "D:\bld\radical.gtod_1715454527932\_test_env\Lib\site-packages\radical\utils\__init__.py", line 19, in <module>
    from .atfork         import *
  File "D:\bld\radical.gtod_1715454527932\_test_env\Lib\site-packages\radical\utils\atfork\__init__.py", line 21, in <module>
    from .atfork       import monkeypatch_os_fork_functions, atfork
  File "D:\bld\radical.gtod_1715454527932\_test_env\Lib\site-packages\radical\utils\atfork\atfork.py", line 55, in <module>
    _orig_os_fork    = os.fork
                       ^^^^^^^
AttributeError: module 'os' has no attribute 'fork'

It seems like this needs some sort of if around it to handle the Windows situation where os.fork doesn't exist.

xylar commented 6 months ago

See: https://github.com/conda-forge/radical.gtod-feedstock/pull/13 https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=932218&view=logs&j=e5cdccbf-4751-5a24-7406-185c9d30d021&t=0c979b57-e97b-5e0a-363d-f964823a2ab0&l=1201

xylar commented 6 months ago

It could also be that this is caused by me messing something up on conda-forge (e.g. by building the conda package as noarch: python). If so, I'll close this.

xylar commented 6 months ago

Ah, sorry, I see that Windows was just skipped previously on conda-forge. My mistake!