darcy-roper / CG_quota

Programs for scraping world athletics webpage to determine Australia's top athletes eligible for selection in the 2022 Birmingham Commonwealth Games
1 stars 0 forks source link

Destination paths to save txt files #2

Closed darcy-roper closed 2 years ago

darcy-roper commented 2 years ago

Each main program will write website data into a local txt file. The paths currently specified are for my local device e.g /Users/macusername/Desktop/Foldername/ These will need to be updated with universal inputs to fetch the username of the local device name and create folders for which the output txt file can print and save into.

howlinghuffy commented 2 years ago

To make it easier to collaborate on different systems, absolute references to files should be avoided. This can be done by replacing an absolute reference:

open('/Users/newmac/Desktop/Programs and Code/my_file.txt', 'wt')

with a simple relative reference

open('my_file.txt', 'wt')

This will open a file my_file.txt in the same folder that you execute the Python program from.

To make it even cleaner, and separate the files from the code, you might add a folder called output within your current folder, and then you would open the file like this:

open('output/my_file.txt', 'wt')

darcy-roper commented 2 years ago

Thanks mate, I've updates the path references to remove absolutes.

These now are printing all program .txt files to the output folder on the main branch.