Я пытаюсь импортировать python файл Sonderbuch_BASECASE_3ph.py
в другой python файл test.py
. test.py
находится в основном каталоге foo
, а Sonderbuch_BASECASE_3ph.py
находится в подкаталоге grid_data
.
![enter image description here](https://i.stack.imgur.com/qtz8n.png)
Sonderbuch_BASECASE_3ph.py
has a function with the same name, which I need to import as well:
# Sonderbuch_BASECASE_3ph
from numpy import array
def Sonderbuch_BASECASE_3ph():
.....
Both of these attempts to import result in a SyntaxError
:
from grid_data import Sonderbuch_BASECASE_3ph
import grid_data.Sonderbuch_BASECASE_3ph
Output:
Traceback (most recent call last):
File "C:/Users/Artur/Desktop/foo/test.py", line 1, in
from grid_data import Sonderbuch_BASECASE_3ph
File "C:\Users\Artur\Desktop\foo\grid_data\Sonderbuch_BASECASE_3ph.py", line 1550
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe4 in position 29: invalid continuation byte
Edit:
The encoding of the file seems to be windows-1252
, at least that is what pycharm is proposing. Decoding the file in windows-1252
does not solve the ErrorMsg though. Sonderbuch_BASECASE_3hp.py
is just a storage file for a dictionary. I was hoping I could just import it.
введите описание изображения здесь
Кажется, что ни одна из кодировок не работает.