Hydrogen, python working directory is one folder up from the current folder. How do i change it to the current folder?


#1

Hi,
In both Hydrogen and using a plug-in terminal platform (platformio-ide-terminal), the default directory is one folder up from where my code file resides.

E.g., i’ll be working on a file with path, say, parent/code/file.py. When I run pwd in terminal or the equivalent via Hydrogen in the python script i get parent/, but I need it to be parent/code/ to import files etc.

Perhaps the default directory for Atom is the project that is folder of the project that is open?

Any ideas how to change the default current directory for Atom (or is it package specific) to the file i’m working on/executing in Hydrogen?


#2

Atom does not have a built in terminal. You must be using one provided by a third party package.


#3

yes, sorry for the confusion. I edited the question. It is “a plug-in terminal”, specifically platformio-ide-terminal


#4

platformio-ide-terminal offers the choice of home folder, project folder, or active file as the starting directory. I haven’t used hydrogen, so I can’t help there. I recommend going through the package settings though, and seeing if there is something relevant.


#6

In case you are using Hydrogen, just change working directory as follows:

  1. find your installed Hydrogen in installed packages (Preferences)
  2. click Settings
  3. find the toggle for ‘Directory to start kernel in’
  4. switch to ‘Current directory of the file’
  5. finish