-1

I have a python 3.6 script that I wrote in Atom editor on macOS. The script uses os.getcwd() routinely and has always worked fine. I restarted my computer last night, updated the Atom packages, and suddenly it broke. Using a print statement, os.getcwd() is now only returning "/".

Tried on multiple scripts, all in different directories.

import os
print(os.getcwd())

Expected: /Users/kpaddock/Desktop/Python/SCID-Report-DRAFT

Actual output: /

Kieran Paddock
  • 375
  • 1
  • 5
  • 15

1 Answers1

0

My mistake, I didn't look hard enough. Turns out os.getcwd() is not always accurate? Replaced with os.path.abspath(os.path.dirname(__file__)) and it works just fine.

Kieran Paddock
  • 375
  • 1
  • 5
  • 15