Import error (python 3.10 and 3.11)
Closed this issue ยท 4 comments
Nickwasused commented
Expected Behaviour
The package should be usable.
Observed Behaviour
Python exists after observing an error with the package.
Error message:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import ntfpy
File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\ntfpy\__init__.py", line 1, in <module>
from .raw_send import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\ntfpy\raw_send.py", line 5, in <module>
from .types.actions import NTFYAction
File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\ntfpy\types\__init__.py", line 3, in <module>
from .client import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\ntfpy\types\client.py", line 10, in <module>
from ..raw_send import raw_send, raw_send_message
ImportError: cannot import name 'raw_send' from partially initialized module 'ntfpy.raw_send' (most likely due to a circular import) (C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\ntfpy\raw_send.py)
Steps to reproduce
- Create a new python file with the following content:
import ntfpy
- Try to run the file.
- The script will exit with an error.
Context (Environment)
- Windows 10
- ntfpy version 0.0.10
- python 3.10 and 3.11
Possible Solution
I don't know.
Nevalicjus commented
I am sadly aware raw_send currently is unimportable due to circulars ๐
This should be fixed in 0.0.11, but until it's released you can use the slightly longer approach of
client = NTFYClient(NTFYserver, topic, NTFYUser)
client.send(message)
Nickwasused commented
The problem is that the error is still present even when using this code:
from ntfpy import NTFYClient, NTFYServer
client = NTFYClient(NTFYServer("https://ntfy.sh"), "test")
client.send("this is a test")
I can import nothing from ntfpy without an error.
Nevalicjus commented
Yep, noticed that myself just after responding to you;
I think I must've somehow not tested the 0.0.10 prior to publishing it; I'll veeery quickly work on the fix then ๐
Nevalicjus commented
Resolved after 09746bf, in v0.0.11