1

I have the following directory structure:

dir1
    myscript.bat
    P1
        __init__.py            
        test1.py
    P2
        __init__.py
        test2.py

When running, module1 needs to import module2 and I get the following error:

no module named P2.

dir1 contains my pydev project and the project runs correctly in pydev.
The error only happens when using batch file.

How can I fix this error?

I have read the documentation mentioned in the comment, but have not been able to solve my error. Below I have the contents of module 1 and 2 and myscript.bat.

test.py:

from P2.test2 import test2

def test():
    print(" I am module test")

test2.py:

def test2():
    print(" I am module test2")

myscript.bat

set PATH=%PATH%;Python34\DLLs
SET PYTHONPATH=P1;P2
.\python34\python .\P1\test.py
Heli
  • 159
  • 1
  • 3
  • 10

0 Answers0