1
tree
 systemMonitoring
├── ddos_logging_service.py
├── __init__.py
├── setup.py
├── systemMonitor
│   ├── __init__.py
│   ├── monitor.py
│   └── source.py
└── systemMonitor.service

Its my python program file hierarchy... I created systemMonitor directory on my python program to seperate setup.py and service file from others. After separation,when I try to run monitor.py I'm getting this error:

    File "monitor.py", line 3, in <module>
    from systemMonitor import source  
    ImportError: No module named 'systemMonitor'

begining monitor.py is:

  #!/usr/bin/python3
import time,psutil
from systemMonitor import source

1 Answer 1

1

In systemMonitor/monitor.py:

#!/usr/bin/python3
import time,psutil
from . import source

Check this: https://docs.python.org/2.5/whatsnew/pep-328.html

Sign up to request clarification or add additional context in comments.

4 Comments

not worked File "systemMonitor/monitor.py", line 3, in <module> from . import source SystemError: Parent module '' not loaded, cannot perform relative import
@pala9323 How did you run the program? By python monitor.py?
python3 monitor.py
@pala9323 Then just import source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.