My bad, maybe I wasn't clear the first time. I am indeed talking about the cwd of my kernel process.
When I run jupyter from the command line and I open an ipynb file, the cwd of the kernel process will always default to a one different from where it was opened. E.g. 'C:\\Users\\XXX\\Dropbox\\esen_ra\\data\\interim\\ja' That's what I get from running the command "pwd" everytime I open a new ipynb file. So I have to (always) write *os.chdir(globals()['_dh'][0])* in order to get: 'C:\\Users\\XXX\\Dropbox\\Master\\ESEN\\Ayudantías\\Python' Which is the correct path where I opened the file. I'm not sure if this helps, but if I run jupyter from Anaconda Navigator, I do not have this problem. I apologize if I'm making things more confusing than they actually are. Software versions: jupyter: 1.0.0 jupyter-client: 5.3.4 jupyter-console: 6.1.0 jupyter-contrib-core: 0.3.3 jupyter-contrib-nbextensions: 0.5.1 jupyter-core: 4.6.1 jupyter-highlight-selected-word: 0.2.0 jupyter-latex-envs: 1.4.6 jupyter-nbextensions-configurator: 0.4.1 jupyterthemes: 0.20.0 Thanks in advance, JA. On Tue, Jan 28, 2020 at 11:16 PM Jason Grout <[email protected]> wrote: > Ah, I think I misunderstood your question. I thought you were talking > about the default folder path for the notebook server, but it seems instead > you are talking about the current working directory of your kernel process? > > Can you give us more information? What path is your notebook in and what > is your kernel current working directory, and how might those two paths be > related? Have you reproduced this in a clean environment? What versions of > software are you running? > > Thanks, > > Jason > > > > On Tue, Jan 28, 2020 at 8:45 PM Javi Alfaro <[email protected]> > wrote: > >> Hi Jason, >> >> Thank you very much for your response. I tried everything, but for some >> reason the problem still persists. >> >> The only code that gave me the real working folder path was : >> >> globals()['_dh'][0] >> >> And I took it from: >> https://stackoverflow.com/questions/39125532/file-does-not-exist-in-jupyter-notebook/53958599#53958599 >> >> But I wasn't able to make the ipynb file to load the current folder path >> :( ... I also tried uninstalling and installing jupyter again. >> >> On Tue, Jan 28, 2020 at 4:49 PM Jason Grout <[email protected]> wrote: >> >>> You can change that default directory in the notebook configuration, or >>> from the comand line with: jupyter notebook >>> --NotebookApp.notebook_dir='/path/to/directory'. >>> >>> Perhaps you need to look at your config file. You can find the config >>> file in one of the config directories listed by `jupyter --paths`. Look for >>> the jupyter_notebook_config.py file. >>> >>> Here are instructions for setting that config value, which may help >>> narrow down things: https://stackoverflow.com/a/40514875 >>> >>> Thanks, >>> >>> Jason >>> >>> >>> On Tue, Jan 28, 2020 at 2:02 PM Javi Alfaro <[email protected]> >>> wrote: >>> >>>> Good evening from El Salvador, >>>> >>>> I apologize if my query shouldn't be posted here. >>>> >>>> I understand that when running Jupyter notebooks, the default working >>>> directory is the directory the notebook is open in, but I'm not sure what >>>> happened and this doesn't happen anymore, my current working directory has >>>> been set, accidentally, to a different path. How can I correct this to the >>>> default option? >>>> >>>> Thanks in advance, >>>> >>>> Javier Alfaro. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Project Jupyter" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jupyter/70f17237-6aa0-4ff6-9fca-f4a90972304a%40googlegroups.com >>>> <https://groups.google.com/d/msgid/jupyter/70f17237-6aa0-4ff6-9fca-f4a90972304a%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Project Jupyter" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jupyter/CAPDWZHwGHTW-%3DOFW4%3DbkJTBLtNCqONSxvFNeM%3DWxneERHMp-yA%40mail.gmail.com >>> <https://groups.google.com/d/msgid/jupyter/CAPDWZHwGHTW-%3DOFW4%3DbkJTBLtNCqONSxvFNeM%3DWxneERHMp-yA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Project Jupyter" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jupyter/CACJGEmGLw2coHT%2B1_Ou3WjPK3aogM40gQhdBbPTP65e71NXNMg%40mail.gmail.com >> <https://groups.google.com/d/msgid/jupyter/CACJGEmGLw2coHT%2B1_Ou3WjPK3aogM40gQhdBbPTP65e71NXNMg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Project Jupyter" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jupyter/CAPDWZHzKEcGQDfsnXbEVYu08NMBuB3y%2B%2B_YNYiZVNiYqwP66gg%40mail.gmail.com > <https://groups.google.com/d/msgid/jupyter/CAPDWZHzKEcGQDfsnXbEVYu08NMBuB3y%2B%2B_YNYiZVNiYqwP66gg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CACJGEmFzrmtiw6vOsSRPDbvyG5ZQ98k7Q2teDo%3DkRgoZsYO_aQ%40mail.gmail.com.
