1

I have gone through the explanations given in this forum and have tried them in my program. However, none of the suggestions worked. That's why I am opening this thread.

Below is the tree for my project. There are 2 packages: com and main.

enter image description here

When I try to run the code for ProcessRiskModelbyRecordID.py from command line, I am getting below error message:

$ python3 /AppDev/XXXX/py/riskScore/main/ProcessRiskModelbyRecordID.py

Traceback (most recent call last): File "/AppDev/XXXX/py/riskScore/main/ProcessRiskModelbyRecordID.py", line 6, in from main.ConnectAPI import * ModuleNotFoundError: No module named 'main'

When I run the same code from PyDev, I am able to execute it.

Below is the import code from ProcessRiskModelbyRecordID.py:

from main.ConnectAPI import * from com import DBOperations as DBO,SourceProfile,TargetProfile

Can you please help so that I can run this code from command line?

1 Answer 1

1

PyDev is probably setting PYTHONPATH for you. On the command line you would need to set it yourself:

cd riskScore 
export PYTHONPATH=`pwd`
python3 main/ProcessRiskModelbyRecordID.py
Sign up to request clarification or add additional context in comments.

Comments

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.