oreilly-japan / deep-learning-from-scratch

『ゼロから作る Deep Learning』(O'Reilly Japan, 2016)
MIT License
4.04k stars 3.36k forks source link

Use os.pardir when modifying sys.path #10

Closed hnakamur closed 7 years ago

hnakamur commented 7 years ago

In the book and the other source codes except ch05/train_neuralnet.py uses

sys.path.append(os.pardir)

but ch05/train_neuralnet.py uses

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

to add the parent directory to sys.path.

With this fix, you can run exec(open('train_neuralnet.py').read()) successfully on Python3 prompt in ch05 directory.

koki0702 commented 7 years ago

Thank you!