K
K
kapai692018-06-07 16:52:49
Python
kapai69, 2018-06-07 16:52:49

Import modules from current directory?

Good afternoon!
On the server, importing files that are in the same directory works only through . (dot) If the dot is removed, then a fatal crash occurs that the module is not found. Without a dot it worked for python 2.7 after upgrading to 3.5 it stopped. I read that these versions have a different search priority for modules. How to make python look first in the current folder and then look for global modules? The main question is how to get rid of the dot?
from .app import app

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ariezzz_python, 2018-07-17
@ariezzz_python

How to make python look first in the current folder and then look for global modules?
Create an empty __init__.py file in the current directory
. The main question is how to get rid of the dot?
Try 2to3, I'm not sure but I think it fixes this problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question