alufers / mitmproxy2swagger

Automagically reverse-engineer REST APIs via capturing traffic
5.08k stars 221 forks source link

Broken Imports #160

Open TheBagarius opened 7 months ago

TheBagarius commented 7 months ago

I don't understand what is going on in the error message below. Also I cannot call mitmproxy2swagger from the command line after installing it with pip3 install mitmproxy2swagger I have to forcefully call it from the full filepath with python3

bumping #153

$ python3 ~/Library/Python/3.9/lib/python/site-packages/mitmproxy2swagger/mitmproxy2swagger.py -i ~/Documents/TMS-login\ flows -o ~/Documents/tms_trials
Traceback (most recent call last):
  File "/Users/USER/Library/Python/3.9/lib/python/site-packages/mitmproxy2swagger/mitmproxy2swagger.py", line 16, in <module>
    from mitmproxy2swagger import console_util, swagger_util
  File "/Users/USER/Library/Python/3.9/lib/python/site-packages/mitmproxy2swagger/mitmproxy2swagger.py", line 16, in <module>
    from mitmproxy2swagger import console_util, swagger_util
ImportError: cannot import name 'console_util' from partially initialized module 'mitmproxy2swagger' (most likely due to a circular import) (/Users/USER/Library/Python/3.9/lib/python/site-packages/mitmproxy2swagger/mitmproxy2swagger.py)
josephwandery commented 6 months ago

Hello,try installing it in a virtual environment.

rithvikvibhu commented 2 months ago

Looks like it's because the directory (mitmproxy2swagger) and the main file (mitmproxy2swagger.py) are of the same name. To confirm, renaming it to mitmproxy2swagger_main.py will make the script work.

But yeah, if installed globally properly, this should not be requried and works fine.