I have three python scripts START.py
, credentials.py
and ask_LDAP.py
. The first is in the Szperacz_2.0
directory, which is the root directory
for the rest, the next two are in the src
directory, one level down.
Szperacz_2.0
|
| START.py
|- src
| | - credentials.py
| | - ask_LDAP.py
When I run ask_LDAP.py
everything works and the console asks for login
and password
and then prints the entered characters. The problem is when I run START.py
, the console asks for login
and password
and then returns an error
:
Traceback (most recent call last):
File "d:\Szperacz_2.0\START.py", line 10, in <module>
import credentials
ModuleNotFoundError: No module named 'credentials'
I apologize in advance if the problem is trivial but I am a beginner in python.
my scripts:
./START.py
import os
# --- Clearing the Screen
os.system('cls')
path = "./src/credentials.py"
exec(open(path).read())
path = "./src/ask_LDAP.py"
import credentials
exec(open(path).read())
./src/credentials.py
import getpass
login = input("Login: ")
password = getpass.getpass()
./src/ask_LDAP.py
import credentials
login = credentials.login
password = credentials.password
print("login from credentials.py: " + login)
print("passwd from credentials.py: " +password)