0

I am currently on python project with bunch of people on GitHub.

I noticed that every time I want to download codes and run on my side, or my teammate side, we have to edit file path to their own working directly in order to read files.

Is there anyway to standardize the working directly and skip the process for everyone trying to run the code in their local environment?

Thank you!

  • 1
    See https://stackoverflow.com/questions/595305/how-do-i-get-the-path-of-the-python-script-i-am-running-in to get the path to currently running script. Based on this you can construct paths to other files around. – Michael Butscher Jul 30 '21 at 13:03
  • 2
    How do you run the code? What do you mean by "edit file path to their own working (directory, I assume)"? Are you editing anything in the code? It would be good to get some better details. From what I understand you should look at relative imports. – Kacperito Jul 30 '21 at 13:53
  • 1
    Use relative paths, don't include user or machine specific stuff in paths. – Robert Jul 30 '21 at 23:56
  • 1
    Similar to the above comment on getting current path, you have to modify your committed codes to not have any hardcoded paths, and let it figure out the current local directory/path on every run. Does this answer your question? [How do you properly determine the current script directory?](https://stackoverflow.com/questions/3718657/how-do-you-properly-determine-the-current-script-directory) – Gino Mempin Jul 31 '21 at 01:30

0 Answers0