noqdev / iambic

IAMbic is Version-Control for IAM. It centralizes and simplifies cloud access and permissions. It maintains an eventually consistent, human-readable, bi-directional representation of IAM in Git.

Home Page:https://iambic.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python Signal error on Windows OS

0xAJX opened this issue · comments

Describe the bug

Whenever there is an exception raised, the actual error gets masked with 'signal' has no attribute 'SIGALRM' which makes it difficult to debug. This bug is Windows specific.

To Reproduce

Cause an exception on Windows and the error will be shown.

Expected behavior

If an exception occurs then the actual error should be shown instead of Signal error.

Desktop

  • OS: Windows 10
  • Version: 19045.3324
  • Python: 3.11.4

StackTrace

2023/08/15 15:48:36 [error ] Unable to run exception reporting logic
error=module 'signal' has no attribute 'SIGALRM'
exc_info=True

i am able to reproduce as well

2023/08/24 14:44:35 [error    ] Unhandled Exception
  error=PermissionError(13, 'Permission denied')
  exception=PermissionError
  stacktrace=  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\micro\test2\env\Scripts\iambic.exe\__main__.py", line 7, in <module>
    sys.exit(cli())
             ^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\iambic\main.py", line 500, in lint
    templates = load_templates(templates, config.template_map, False)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micro\test2\env\Lib\site-packages\iambic\core\parser.py", line 108, in load_templates
    template_dicts = p.map(load_template_fn, template_paths)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\pool.py", line 774, in get
    raise self._value

2023/08/24 14:44:35 [error    ] Unable to run exception reporting logic
  error=module 'signal' has no attribute 'SIGALRM'
  exc_info=True

I am not super familiar with this multiprocessing issue in Windows. If running in WSL2 with Windows is acceptable, I suggest going that route.