I'm learning with a Jupyter notebook
I am having trouble setting the sys.path or not being able to read the folder with a specific name.

Specifically, it does not load the folder named "common".
The common folder certainly exists in the parent directory of the executable file,
This does not mean that the folder itself does not exist because layers.py is included.

Also, if the folder has another name, it can be read without any problem.

I was learning in a book called "Deep Learning 2-Natural Language Processing"
Download the sample code from the following. The corresponding code can be found in "two_layer_net.py" in the "ch01" folder.

Thanks for your cooperation.
m(_ _)m

-------------------------------------------------- -------------------------
ModuleNotFoundError Traceback (most recent call last)
      2 sys.path.append('..')
      3 import numpy as np
---->4 from common.layers import Affine, Sigmoid, SoftmaxWithLoss
ModuleNotFoundError: No module named'common.layers'
Applicable source code
import sys
import numpy as np
from common.layers import Affine, Sigmoid, SoftmaxWithLoss
What I tried

Please state what you have tried for the problem here.
If a folder other than the common folder is placed on the same level as the common folder, the reading will succeed with the same description

Copying the common folder and renaming it (eg common44) causes the read operation to succeed for some reason

From the terminal to the common folderchomd 777But no change

Change to sys.path.append(‘..’)→sys.path.append(‘../common’)
Stop error message by deleting common part from import part of file in common folder
Examplefrom common.np import *from np import *

Supplementary information (FW/tool ​​version, etc.)

jupyter-notebook: 5.6.0

  • Answer # 1

    Is there a module with the same name?

    If so,
    sys.path.insert(0, "..")Then you may enter the beginning of path and find the common.layers you want to use first.