MINGW-packages: python 3.7: loading of classes from sibling files fails with ModuleNotFoundError

Since Python was updated from 3.6 to 3.7 loading of classes from sibling files does not work anymore.

Steps to reproduce:

file_with_class.py:

class TestClass: pass

import_class_from_file.py:

from file_with_class import TestClass

testClass = TestClass()

Save both files in the same directory ($DIRECTORY). Run import_class_from_file.py (python3.7 $DIRECTORY/import_class_from_file.py). This yields the following error:

$ python3 /c/45/import_class_from_file.py
Traceback (most recent call last):
  File "C:/45/import_class_from_file.py", line 1, in <module>
    from file_with_class import TestClass
ModuleNotFoundError: No module named 'file_with_class'

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments