[IPython-dev] System commands fail (path not assigned)

Fernando Perez Fernando.Perez at colorado.edu
Fri Dec 30 09:45:55 CST 2005


Ville Vainio wrote:
> There's a bug in current svn.
> 
> Did svn up, setup.py install, started ipython -p pysh, entered system
> command ls, got
> 
> [opt\environmentswitch]|1> ls
> ---------------------------------------------------------------------------
> exceptions.UnboundLocalError                         Traceback (most recent call
>  last)
> 
> c:\python24\Lib\site-packages\IPython\iplib.py in <lambda>(cmd)
>     518         self.system = lambda cmd: shell(self.var_expand(cmd),
>     519                                         header='IPython system call: ',
> --> 520                                         verbose=self.rc.system_verbose)
>     521         # These are for getoutput and getoutputerror:
>     522         self.getoutput = lambda cmd: \
> 
> c:\python24\Lib\site-packages\IPython\genutils.py in shell(cmd, verbose, debug,
> header)
>     353                 os.chdir(path)
>     354         else:
> --> 355             shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
>     356
>     357     shell.__doc__ = shell_ori.__doc__
> 
> UnboundLocalError: local variable 'path' referenced before assignment

OOPS, sorry.  The bug is win32-only, I mis-applied Jorgen's patch for network 
shares when I refactored it.  Thanks for reporting this.  I've just updated 
svn and released an rc2 with the fix.  If you want to apply it manually, it's 
trivial:

Index: IPython/genutils.py
===================================================================
--- IPython/genutils.py (revision 979)
+++ IPython/genutils.py (working copy)
@@ -352,7 +352,7 @@
              finally:
                  os.chdir(path)
          else:
-            shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
+            shell_ori(cmd,verbose,debug,header)

      shell.__doc__ = shell_ori.__doc__


Thanks for the report.

Cheers,

f




More information about the IPython-dev mailing list