3636from IPython .utils .openpy import source_to_unicode
3737from IPython .utils .path import unquote_filename
3838from IPython .utils .process import abbrev_cwd
39+ from IPython .utils import py3compat
3940from IPython .utils .py3compat import unicode_type
4041from IPython .utils .terminal import set_term_title
4142
@@ -180,7 +181,7 @@ def rehashx(self, parameter_s=''):
180181 winext += '|py'
181182 execre = re .compile (r'(.*)\.(%s)$' % winext ,re .IGNORECASE )
182183 isexec = lambda fname :os .path .isfile (fname ) and execre .match (fname )
183- savedir = os . getcwdu ()
184+ savedir = py3compat . getcwd ()
184185
185186 # Now walk the paths looking for executables to alias.
186187 try :
@@ -234,7 +235,7 @@ def pwd(self, parameter_s=''):
234235 In [9]: pwd
235236 Out[9]: '/home/tsuser/sprint/ipython'
236237 """
237- return os . getcwdu ()
238+ return py3compat . getcwd ()
238239
239240 @skip_doctest
240241 @line_magic
@@ -278,7 +279,7 @@ def cd(self, parameter_s=''):
278279 /home/tsuser/parent/child
279280 """
280281
281- oldcwd = os . getcwdu ()
282+ oldcwd = py3compat . getcwd ()
282283 numcd = re .match (r'(-)(\d+)$' ,parameter_s )
283284 # jump in directory history by number
284285 if numcd :
@@ -351,7 +352,7 @@ def cd(self, parameter_s=''):
351352 except OSError :
352353 print (sys .exc_info ()[1 ])
353354 else :
354- cwd = os . getcwdu ()
355+ cwd = py3compat . getcwd ()
355356 dhist = self .shell .user_ns ['_dh' ]
356357 if oldcwd != cwd :
357358 dhist .append (cwd )
@@ -361,7 +362,7 @@ def cd(self, parameter_s=''):
361362 os .chdir (self .shell .home_dir )
362363 if hasattr (self .shell , 'term_title' ) and self .shell .term_title :
363364 set_term_title ('IPython: ' + '~' )
364- cwd = os . getcwdu ()
365+ cwd = py3compat . getcwd ()
365366 dhist = self .shell .user_ns ['_dh' ]
366367
367368 if oldcwd != cwd :
@@ -387,7 +388,7 @@ def pushd(self, parameter_s=''):
387388
388389 dir_s = self .shell .dir_stack
389390 tgt = os .path .expanduser (unquote_filename (parameter_s ))
390- cwd = os . getcwdu ().replace (self .shell .home_dir ,'~' )
391+ cwd = py3compat . getcwd ().replace (self .shell .home_dir ,'~' )
391392 if tgt :
392393 self .cd (parameter_s )
393394 dir_s .insert (0 ,cwd )
@@ -676,7 +677,7 @@ def bookmark(self, parameter_s=''):
676677 if not args :
677678 raise UsageError ("%bookmark: You must specify the bookmark name" )
678679 elif len (args )== 1 :
679- bkms [args [0 ]] = os . getcwdu ()
680+ bkms [args [0 ]] = py3compat . getcwd ()
680681 elif len (args )== 2 :
681682 bkms [args [0 ]] = args [1 ]
682683 self .shell .db ['bookmarks' ] = bkms
0 commit comments