Circular import error
Closed this issue · 4 comments
Mitch0S commented
G'day!
I just got around to trying the 1.3.0 release. I created a fresh project on PyCharm, using Python 3.10 - When running the following code:
from mitm import MITM, CertificateAuthority, middleware, protocol
from pathlib import Path
# Loads the CA certificate.
path = Path("")
ca = CertificateAuthority.init(path=path)
# Starts the MITM server.
mitm = MITM(
host="127.0.0.1",
port=8888,
protocols=[protocol.HTTP],
middlewares=[middleware.Log],
buffer_size=8192,
timeout=5,
ca=ca,
)
mitm.run()
It throws this error:
Traceback (most recent call last):
File "/Users/myname/PycharmProjects/ComputerScience/misc/mitm.py", line 1, in <module>
from mitm import CertificateAuthority, middleware, protocol
File "/Users/myname/PycharmProjects/ComputerScience/misc/mitm.py", line 1, in <module>
from mitm import CertificateAuthority, middleware, protocol
ImportError: cannot import name 'CertificateAuthority' from partially initialized module 'mitm' (most likely due to a circular import) (/Users/myname/PycharmProjects/ComputerScience/misc/mitm.py)
synchronizing commented
That's weird. Not getting that on my system with a fresh install of mitm
. What Python version are you running?
Mitch0S commented
Yeah it is strange, never had an issue beforehand. Python 3.10
…On Tue, 24 May 2022 at 04:59, Felipe ***@***.***> wrote:
That's weird. Not getting that on my system with a fresh install of mitm.
What Python version are you running?
—
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQCZ5GC4M2NLBQYJYUVHIZ3VLPWSZANCNFSM5WVN43WA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
Mitch0S commented
Never-mind, seems to be working now. That was weird... I haven't changed
anything...
…On Tue, 24 May 2022 at 07:51, Mitch Naake ***@***.***> wrote:
Yeah it is strange, never had an issue beforehand. Python 3.10
On Tue, 24 May 2022 at 04:59, Felipe ***@***.***> wrote:
> That's weird. Not getting that on my system with a fresh install of mitm.
> What Python version are you running?
>
> —
> Reply to this email directly, view it on GitHub
> <#15 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AQCZ5GC4M2NLBQYJYUVHIZ3VLPWSZANCNFSM5WVN43WA>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
synchronizing commented
Weird, but glad its working now 😄 . Closing this for now.