tensorflow / swift

Swift for TensorFlow
https://tensorflow.org/swift
Apache License 2.0
6.12k stars 608 forks source link

Wrong current working directory in Xcode Mac project #434

Open ematejska opened 4 years ago

ematejska commented 4 years ago

Imported from JIRA: https://bugs.swift.org/browse/TF-1093

Type: Bug Priority: Major
Reporter: Rahul Bhalley Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: RunTimeCrash, Runtime
Environment: System: MacBook Pro (13-inch, 2016)OS: macOS Catalina 10.15.2 (19C57)Toolchain: Swift for TensorFlow Development Snapshot 2019-12-23Xcode: Version 11.3 (11C29)

Bug After being able to fix the problem with running S4TF program in Xcode Mac project, Python (through interoperation) detects wrong current working directory (CWD) although terminal shows correct CWD in Python after navigating to where main.swift file lives.

Wrong CWD: /Users/rahulbhalley/Library/Developer/Xcode/DerivedData/WGAN-bgnsyrtevzkjhafkqliiqunqbydo/Build/Products/Debug

Correct CWD: /Users/rahulbhalley/Desktop/Swift/MI-with-Swift/Source-Code/S4TF/WGAN/WGAN

Consequences Since detected CWD is wrong in Xcode project via Python it is difficult to load dataset, save/load parameters, or create new file/directory, etc. in the project location. One way is to use absolute path but usually user expects relative path specification in Python-based DL. All the works done in CWD will be written to Wrong CWD whereas the desired location from user viewpoint is Correct CWD.