Doesn't work with Python 3.9+
mgeeky opened this issue · 3 comments
Hi!
While trying to run o365spray, following bit crashes:
PS C:\o365spray> py .\o365spray.py --help
Traceback (most recent call last):
File "C:\data\tools\__Azure\o365spray\o365spray.py", line 4, in <module>
from o365spray.__main__ import main # type: ignore
File "C:\data\tools\__Azure\o365spray\o365spray\__main__.py", line 14, in <module>
from o365spray.core import ( # type: ignore
File "C:\data\tools\__Azure\o365spray\o365spray\core\__init__.py", line 8, in <module>
from o365spray.core.handlers import Enumerator # type: ignore
File "C:\data\tools\__Azure\o365spray\o365spray\core\handlers\__init__.py", line 1, in <module>
from o365spray.core.handlers.enumerator import Enumerator # type: ignore
File "C:\data\tools\__Azure\o365spray\o365spray\core\handlers\enumerator.py", line 37, in <module>
class Enumerator(BaseHandler):
File "C:\data\tools\__Azure\o365spray\o365spray\core\handlers\enumerator.py", line 45, in Enumerator
loop: asyncio.base_events._UnixSelectorEventLoop,
AttributeError: module 'asyncio.base_events' has no attribute '_UnixSelectorEventLoop'
Could you please look into this?
Regards,
Mariusz
@mgeeky Sorry for the delay on this - This is due to Python's asyncio library using a different event loop type on Windows. Instead of asyncio.unix_events._UnixSelectorEventLoop
, it uses asyncio.windows_events.ProactorEventLoop
.
I am working on a fix for this as well as several updates.
As a temporary fix, you can locally remove or replace the typing for the loop object being passed to both the Enumerator and Sprayer classes:
enumerator.py#L45
sprayer.py#L45
As a side note, the colorized output is currently targeting non-Windows systems, so if run on Windows the output will be slightly broken. Getting that fixed as well
This should now be fixed in the 'dev' branch