Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The distinction between "working directory for newly opened consoles" and "working directory for current console" is hard to understand #3257

Closed
ChristianKleineidam opened this issue Jun 25, 2016 · 11 comments

Comments

@ChristianKleineidam
Copy link

Currently Spyder has at the top of the UI a line that specify the working directory for newly opened consoles.
As a new user I would have expected it also to switch the current working directory and got confused about how to set my working directory. Currently the menu also doesn't offer a menu point of "set working directory".

I think it would be easiest if the top of the UI always shows the current working directory.

Alternatively the UI could show (current working directory) or (not currert working directory) directly after the file path.

@nerdfever
Copy link

nerdfever commented Jun 27, 2016

Agreed. Closely related issue: #2030

Much of this could be fixed by simply rewording the prompts and dialog boxes (using clearer, more consistent terms).

See also https://groups.google.com/forum/#!topic/spyderlib/H4d0gsQWtPQ for further elaboration of what's confusing here.

@malliwi88
Copy link
Contributor

Hi, @ChristianKleineidam @nerdfever

Which Spyder version you have?

Actually (In Spyder v3.0.1), Preference UI looks like as:

preferences_001

preferences_002

Could you say us: If the clarifications on the current user interface, meets your expectations or not? and because?.

We appreciate your recommendations to improve spyder in this regard and further solve your issues. :)

@nerdfever
Copy link

nerdfever commented Oct 24, 2016

@malliwi88 Thanks for looking into this issue.

If you read thru the other comments on related issues (linked above), I think it's pretty clear that most of the problem comes from use of unclear or inconsistent terms.

The Python os module defines os.getcwd(). "cwd" stands for "current working directory".

So to be consistent with the os module, I think the term "current working directory" should be used.

So re Preferences>Run:

1 - I'm still not sure what "Default working directory" does, but if in fact it controls the current working directory (cwd) when Spyder starts, then:

"Default working directory is:" >>> "Default working directory (the current working directory when Spyder starts) is:"

2 - It's still not clear to me where/what "the script directory" is. I have many scripts in many directories. In fact I can have many scripts, from different directories, open in Spyder at the same time. So which directory is this referring to?

3 - I don't think the checkbox "Enter debugging mode when..." belongs in this list, as if it's a 3rd choice for the default working directory.

Re Preferences>Global working directory:

1 - The description is pretty good, I think.

2 - In two places this menu uses the term "current file directory". Is that the same or different from the "current working directory"? If it's the same, call it that. If not, describe what it is.

3 - What is a "file base directory" (last box in the dialog box)? Is this the same as the "global working directory" or the "current working directory" or the "current file directory"? And "Change" what? I find it completely unclear - the dialog box uses 4 different terms to describe somewhere between 2 and 4 concepts.

Whatever it is, if it's one of the previously defined directories, call it by the same term used above. If it's a different thing, describe what it is.

If the "file base directory" is in fact the directory that a given file is in (as I suspect it might be), and these checkboxes are offering the option to change Python's cwd when opening/saving a file, then I suggest it should say:

Set Python current working directory to file location when:
[ ] Opening a file in Spyder's editor
[ ] Saving a file in Spyder's editor

(Of course if that's not what it does, then this is all wrong. I don't know what it does.)

I hope this is helpful.

@nerdfever
Copy link

Perhaps it would be useful, as part of an overall review of Spyder's UI, to make a glossary of terms used in menus and dialog boxes.

Any time you find two or more terms referring to the same concept, clean it up (pick one term, use it consistently, and make sure it's clearly defined what it means).

@malliwi88
Copy link
Contributor

malliwi88 commented Oct 25, 2016

I agree that the UI can be confusing in two cases:

  • Due to unfamiliarity with Spyder.
  • And little information about it on the website and documentation (Actualization coming soon).

I hope to resolve your doubts at the moment with this demonstrative example 😉

some important details for my demonstrative example:

  • I have two files locate in differents folders on my machine as well
    seleccion_003
  • And this configuration on (preferences -> Run):
    seleccion_004
  • And this configuration on (preferences -> Global working directory):
    seleccion_005

Ok!! Start with the example!!! For solve in order of your last post:

you: So to be consistent with the os module, I think the term "current working directory" should be used.

ans-> The term Global directory at the moment refers to the folder that Spyder uses at moment to start. So this is used for this things:

  • Run a new Python/IPython console, the Spyder Global directory is your working directory for this new console 👍 As you can see here
    seleccion_006

So re Preferences>Run:

  1. "Default working directory is (I selected: Execute in current Python/IPython Console!!!):"

    • IIf you run code directly on this consoles, it's the same Global Spyder directory (My case /home/wallas/Documents) as you can see above. ☝️
  2. script directory is

  • If you run a Script current directory automaticly changes to path where the file is (If you remember, It was my configuration in preferences -> Run ) ☝️

Please, read All highlighted text in next picture for you can understand better my example
👍
seleccion_007

  1. * "Enter debugging mode when..."*

    * I'm not sure at the moment. But I think it has to do with the idea of an external debugger for Spyder (It's an idea in development yet). @ccordoba12 @goanpeca - Maybe we should hide this checkbox at the moment? - What do you think?

Re Preferences>Global working directory:

  1. The description is pretty good, I think. Ok, Great!!! 👍
  2. * In two places this menu uses the term "current file directory". Is that the same or different from the "current working directory"? If it's the same, call it that. If not, describe what it is.*

It's depends on your configurations!. I choose:

  • The first One In Open File -> the current directory (It's the path when you go to File -> open)

This option is here because some people should prefer opens only files located on Spyder Global Directory (You remember, Just in my example, it is on: /home/wallas/Documents)

  • The Second One New File -> Spyder Global directory (in my example)

It will be the path where new file will be created (Only created, not saved!!!), when you go to File -> New File

  1. *What is a "file base directory" (last box in the dialog box)? Is this the same as the "global working directory" or the "current working directory" or the "current file directory"? *

Yes, In my opinion, these options in check box file base directory are quite redundant.
However, those are disabled by default on Spyder configuration. Those options only guaranty two things:

  • (When you Open a file) ->> Use the parent path of your Actual File If you have a file open in your editor
  • (When you Save a file) ->> Use the parent path of your last one File opened (If you have a file open in your editor)

I will be reporting this redundant option in this moment @ccordoba12, @goanpeca, fot know your opinions about this.

Not being more, for now. I hope this lengthy example solve your confusion and many other users.

I think this anger for the project wiki;)

Best regards @nerdfever @ChristianKleineidam

@malliwi88
Copy link
Contributor

malliwi88 commented Oct 25, 2016

@goanpeca the last example, Is it useful for the wiki page? or It's irrelevant.

@nerdfever
Copy link

@malliwi88 Thanks! This is very helpful re explaining how Spyder works. But still some things are not completely clear. (And of course this needs to be explained to other people who don't find this thread.)

1 - Re "Default working directory" (dwd) and "current working directory" (cwd):

If I understand correctly,

cwd is the directory files will be opened in if no directory is explicitly specified. For example:

f = open("myFile.foo")

Python looks in the cwd for file "myFile.foo".

dwd is the cwd that Python will use when Spyder executes a script (doesn't matter if normal execution or debug execution, correct?). So if I'm editing "u:\data\projects\MyProgram.py" and then run it, if the first lines of that script reads:

import os
print( os.getcwd() )

If "the script directory" was selected in Preferences, this prints:

"u:\data\projects"

If "the following directory" was selected in Preferences and set to "x:\somePlace\orOther", then the script prints:

"x:\somePlace\orOther"

Do I understand correctly? (If you confirm, I'll propose wording for the Preferences box to try to make this clear - I'm a native English speaker.)

2 - "the script directory" means the directory that stores the script being executed by Spyder. (Again, doesn't matter if normal execution or debug execution, correct?). It has nothing to do with the location of files being edited - only of the file being executed.

Correct? (again, if you confirm I'll try to propose wording to make this more clear)

3 - My interpretation of "file base directory" in my earlier post of this thread was correct. It refers to the directory where the file being opened for editing, or saved from the editor, is stored.

Correct?

4 - I'm still not sure what "current file directory" means - I don't think you addressed that point in your post. I'm guessing it means cwd.

Is that correct? If so, it should be called "current working directory" (not current file directory).

Thanks again for working on this problem.

@ghost
Copy link

ghost commented Nov 25, 2016

I have found these issues confusing as well. I think it would be very helpful to implement the suggestions from nerdfever.

@malliwi88
Copy link
Contributor

malliwi88 commented Dec 4, 2016

1-2
I could say that the behavior is similar to that of any office tool (MS Office or OpenOffice), by default always when opening or saving in My Documents (dwd for you), then the cwd is a temporary route that you never know, once you save the file somewhere on your computer then path becomes cwd for the document that saved and dwd to open a new document.

The only difference is that in spyder gives you the possibility to choose a dwd of your preference different from my documents for when you open new python files. Precisely this directory corresponds with the path indicated on preferences-> StartUP-> the following directory
3 - Yes
4 - If you run a Script current directory automatically changes to path where the file is (If you remember, It was my configuration in preferences -> Run )

@ghost
Copy link

ghost commented Jan 20, 2017

The discussion here seems closely related: https://groups.google.com/forum/#!msg/spyderlib/HWCeeO8Tc7o/N_9cfh82AwAJ

@ccordoba12 ccordoba12 modified the milestones: v3.2, v3.x Jan 20, 2017
@ccordoba12 ccordoba12 modified the milestones: v3.2, v3.3 Feb 14, 2017
@ccordoba12
Copy link
Member

@rlaverde, please work on this one.

As we mentioned in the sprint, the idea is to synchronize the working directory toolbar, the file explorer and the %cd magic in the IPython console, so that at any moment a change on any of them appears reflected in the working directory toolbar.

Besides, after changing consoles, the toolbar needs to be updated too to show the cwd of the new console.

@ccordoba12 ccordoba12 changed the title The distinction between "working directory for newly opened consoles" and "working directory for current console" The distinction between "working directory for newly opened consoles" and "working directory for current console" is hard to understand Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants