windows vista - Is there a way to get a local timestamp in my IPython prompt? -


is there way local timestamp in ipython prompt? i'm using ipython 0.10 , python 2.6 on 64-bit windows vista.

my current default prompt is

[c:python26/scripts] |9> 

ok, tried follow directions exactly. however, experience has been config editing best kept ipy_user_conf.py. quote it:

user configuration file ipython (ipy_user_conf.py)  more flexible , safe way configure ipython *rc files (ipythonrc, ipythonrc-pysh etc.)  file imported on ipython startup. can import ipython extensions need here (see ipython/extensions directory).  feel free edit file customize ipython experience.  note such file nothing, backwards compatibility. consult e.g. file 'ipy_profile_sh.py' example of things  can here.  see http://ipython.scipy.org/moin/ipythonextensionapi detailed description on here. 

so have these lines in main():

# -- prompt # different, more compact set of prompts default ones, # show current location in filesystem:  o.prompt_in1 = r'\c_lightblue[\c_lightcyan\y2\c_lightblue]\c_normal\n\c_green|\#>' o.prompt_in2 = r'.\d: ' o.prompt_out = r'[\#] ' 

and this, example:

16:49:50 in[9]:1/7 1           [9] 0.14285714285714285  16:50:09 in[10]: 

questions:

  1. what 1?
  2. how can keep current directory in prompt? before, had

    [c:python26/scripts] |8> 

once more feeling. i'm sorry mess i've made. need report lines either added or modified are:

import_all("os sys random datetime") o.prompt_in1 = r'\c_lightblue[\c_lightcyan\y2\c_lightblue]\c_normal\n\c_green|\#>' o.prompt_in1 = r'${datetime.now().strftime("%h:%m:%s")}[\#]:' o.prompt_out = r'[\#] ' 

the easiest way edit ipythonrc (in home\_ipython directory), , add these lines:

import_mod datetime prompt_in1 '${datetime.datetime.now()} in [\#]: ' # or prompt_in1 '${datetime.datetime.now().strftime("%h:%m:%s")} in [\#]: ' 

alternatively, can add import_mod datetime rc file, , add main() function of ipy_user_conf.py (in same directory):

o = ip.options o.prompt_in1 = r'${datetime.datetime.now()} in [\#]: ' # or o.prompt_in1 = r'${datetime.datetime.now().strftime("%h:%m:%s")} in [\#]: ' 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -