Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive import failing: "ImportError: cannot import name main" #93

Open
pwna5aurus opened this issue Apr 11, 2019 · 10 comments
Open

Recursive import failing: "ImportError: cannot import name main" #93

pwna5aurus opened this issue Apr 11, 2019 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@pwna5aurus
Copy link

The API/api.py is importing * from astra which recursively imports API/api.py, and the logic to skip the import on iterative imports:

if os.getcwd().split('/')[-1] != 'API':
    from API.api import main

isn't working. Here's the trace-back:

Traceback (most recent call last):
  File "astra.py", line 38, in <module>
    from API.api import main
  File "C:\Pentest\Astra\API\api.py", line 38, in <module>
    from astra import *
  File "C:\Pentest\Astra\astra.py", line 38, in <module>
    from API.api import main
ImportError: cannot import name main
@sagarpo
Copy link
Collaborator

sagarpo commented Apr 12, 2019

@pwna5aurus: Will look into this. BDW I have noticed from your comment that you are using windows box to run astra. We have not tested it in windows so we are not sure if that will work. I would recommend to use it linux or mac. Also, ImportError mentioned in your comment is limited to CLI version so you can use web interface of Astra to run the scan.

@sagarpo sagarpo self-assigned this Apr 12, 2019
@sagarpo sagarpo added the bug Something isn't working label Apr 12, 2019
@brianonn
Copy link

brianonn commented Apr 12, 2019

Same problem on OS X with python 2.7.15 . I'll try the web interface as well

@coffee-cat-007
Copy link

coffee-cat-007 commented Apr 16, 2019

I have tried with couple of versions 2.7.14 & 2.7.15 on OSX still no luck.

@sagarpo
Copy link
Collaborator

sagarpo commented Apr 22, 2019

@brianonn : Are you able to access through web interface?

@sagarpo
Copy link
Collaborator

sagarpo commented Apr 22, 2019

@coffee-cat-007 : Try through web interface.

@CreativeWolf
Copy link

Heya,

OS: Ubuntu 16.04
Python version 2.7

Here's the traceback while trying to run the web interface

Traceback (most recent call last):
File "api.py", line 38, in
from astra import *
File "../astra.py", line 14, in
from core.zapscan import *
ImportError: No module named zapscan

While there is zapscan.py inside the directory core, looks like the path is not read

@kashaziz
Copy link

kashaziz commented Oct 15, 2019

Commenting out line 38 in api.py works with web interface.
'# from astra import *'

@lisa50loves
Copy link

I have to try this

@true-hero
Copy link

astra.py has to be launched from directory /app/API, like this:
/app/API # python /app/astra.py --help

@NelsonGaleano
Copy link

A mi me funciono de la siguiente manera:

cd Astra/API/
python ../astra.py --help

y listo!
Gracias @true-hero por la idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants