Open louking opened 11 years ago
In [5]: os.getcwdu()
Out[5]: u'C:\\Users\\Lou'
This is already weird. Does it do the same in pure python ?
Investigating for why it does not update prompt.
Link to SO discussion : http://stackoverflow.com/questions/13387832/ipython-prompt-confusion
Sorry, forgot to put the link to SO in.
I don't understand the question about pure python. The prompt rendering is from ipython, right?
ah, I missed (bookmark:weather)
I though it was jumping from C:\\Users\\Lou
to C:\Users\Lou\Documents\Lou's Software\projects\weather
and that there might have been a issue with the '
in Lou's Software
Never mind the question.
More things to try:
from IPython.core import prompts
prompts.HOME
prompts.cwd_filt(3)
C:/Users/Lou> from IPython.core import prompts
C:/Users/Lou> prompts.HOME
Out[2]: u'\\\\\\:::::ZZZZZ,,,~~~'
C:/Users/Lou> prompts.cwd_filt(3)
Out[3]: u'C:\\Users\\Lou'
C:/Users/Lou> cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
C:/Users/Lou> prompts.HOME
Out[6]: u'\\\\\\:::::ZZZZZ,,,~~~'
C:/Users/Lou> prompts.cwd_filt(3)
Out[7]: u"Lou's Software\\projects\\weather"
Sorry, \Y
becomes cwd_filt2
- can you try the last bit with prompts.cwd_filt2(3)
? Thanks.
C:/Users/Lou> pwd
Out[1]: u'C:\\Users\\Lou'
C:/Users/Lou> from IPython.core import prompts
C:/Users/Lou> prompts.HOME
Out[3]: u'\\\\\\:::::ZZZZZ,,,~~~'
C:/Users/Lou> prompts.cwd_filt2(3)
Out[4]: u'C:/Users/Lou'
C:/Users/Lou> cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
C:/Users/Lou> prompts.HOME
Out[6]: u'\\\\\\:::::ZZZZZ,,,~~~'
C:/Users/Lou> prompts.cwd_filt2(3)
Out[7]: u"C:Lou's Software/projects/weather"
OK, cwd_filt2
appears to be working as it should. The next thing to test is LazyEvaluate
. Can you try this:
from IPython.core import prompts
y3le = prompts.LazyEvaluate(prompts.cwd_filt2, 3)
str(y3le), format(y3le)
cd weather
str(y3le), format(y3le)
C:/Users/Lou> from IPython.core import prompts
C:/Users/Lou> y3le = prompts.LazyEvaluate(prompts.cwd_filt2, 3)
C:/Users/Lou> str(y3le), format(y3le)
Out[3]: ('C:/Users/Lou', u'C:/Users/Lou')
C:/Users/Lou> cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
C:/Users/Lou> str(y3le), format(y3le)
Out[5]: ("C:Lou's Software/projects/weather", u"C:Lou's Software/projects/weather")
Thanks, so that's working. What about get_ipython().prompt_manager.render('in')
?
Hmm
C:/Users/Lou> get_ipython().prompt_manager.render('in')
Out[6]: u"\x01\x1b[0;32m\x02C:Lou's Software/projects/weather> \x01\x1b[0m\x02"
That too is doing what I'd expect (the garbage characters are the control characters for the colour).
Are you doing this in the terminal, or in the Qt console?
I start ipython with
C:\Python27\Scripts\ipython.exe console
So is that the Qt console?
No, this is the ZMQ console. Is is a 2 process terminal. (and I can reproduce the bug on OS X with zmqconsole)
Even if it look the same, you can try
C:\Python27\Scripts\ipython.exe
alone to have classical IPython.
or
C:\Python27\Scripts\ipython.exe qtconsle
to get the qtconsole (but you might have missing dependencies)
Ah, using
C:\Python27\Scripts\ipython.exe
a) it comes up faster, and, b) I get
C:/Users/Lou> cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
C:Lou's Software/projects/weather>
So I'm good.
I had recently upgraded from ipython 0.10.x, and thought I needed some parameter to replace the -p sh (or whatever that option was).
Thanks for the investigation!
Ah, that makes sense, then. Yes, there's not much reason to use 'console' for normal use. I've retitled the issue accordingly.
There isn't really a replacement yet for the sh
profile in earlier versions, but some of the features are now integrated into IPython by default.
Hi Lou,
I mostly work on Linux, where I use Geany. I don't think it's exceptional, but it does what I need it to. When I've used Windows, I've quite liked PyScripter, so you could give that a try. I don't normally use an integrated debugger, though - I just have IPython in another window.
For future reference, the best place to ask questions like that is on the ipython-user mailing list.
thanks again
On Sat, Nov 24, 2012 at 1:04 PM, Thomas Kluyver notifications@github.comwrote:
Hi Lou,
I mostly work on Linux, where I use Geany. I don't think it's exceptional, but it does what I need it to. When I've used Windows, I've quite liked PyScripter, so you could give that a try. I don't normally use an integrated debugger, though - I just have IPython in another window.
For future reference, the best place to ask questions like that is on the ipython-user mailing list http://mail.scipy.org/mailman/listinfo/ipython-user.
— Reply to this email directly or view it on GitHubhttps://github.com/ipython/ipython/issues/2614#issuecomment-10681474.
I am having trouble getting the prompt to show the current working directory in iPython 0.13.1 running in windows. As you can see below, after changing the current working directory to 'C:\Users\Lou\Documents\Lou's Software\projects\loutilities', the \Y3 only shows 'C:/Users/Lou'. The same behavior is seen with \w and {cwd} configurations.
This was discussed with Thomas K at stackoverflow, who investigated and indicated a bug report was needed.
Thomas K asked for output of os.getcwdu(). I used config command to change the prompt (I'd gone back to In [#n] prompt), and In [#n] prompt remained. A clue?
And the original test duplicated...
11/21/12 - Thomas K asked to check get_ipython().prompt_manager.templates: