swcarpentry / python-novice-inflammation

Programming with Python
http://swcarpentry.github.io/python-novice-inflammation/
Other
299 stars 779 forks source link

Issues with filepaths #1021

Open NidhiGowdra opened 1 year ago

NidhiGowdra commented 1 year ago

Some users might have trouble reading data if they use relative paths after downloading and extracting the dataset provided in setup.

Good to add a note of using Absolute paths.

Relative paths: numpy.loadtxt("inflammation-01.csv")

Absolute Paths: Windows: numpy.loadtxt("D:\python-novice-inflammation-data\data\inflammation-01.csv") or numpy.loadtxt(r"D:\python-novice-inflammation-data\data\inflammation-01.csv")

Linux/MacOS: numpy.loadtxt("D:/python-novice-inflammation-data/data/inflammation-01.csv")

Setting the path to the current working directory where the program is being executed: import os os.chdir(os.getcwd())

emilygrabowski commented 1 year ago

Along these lines I'd suggest adding notes indicating what the working directory should be / where files should be saved at key points in the lesson.

For example in the Command-Line episode: $ python ../code/readings_04.py --max inflammation-*.csv assumes that the programmer is currently in the data directory, while $ python sys_version.py appears to be geared towards programmers being in the code directory, but these are not called out explicitly and can trip people up.

bjricketts commented 1 year ago

Would it be a good idea to have that short note about the working directory in either the Python Fundamentals episode or the Analyzing Patient Data episode? I've discussed the working directory for students at the start of Analyzing Patient Data episode when first loading in the data as it feels like the first place that a user can get tripped up.

On the same topic, there is a short note during setup that the user should be in the data folder but it only appears in the Juypter notebook setup. I think the setup should make a note that the user should be in the data folder (which isn't hidden inside of a drop down of one of the options of launching the python interface).