[IPython-User] Warning when running code with 'import gtk'
Mon Nov 14 16:27:55 CST 2011
On Mon, Nov 14, 2011 at 13:57, Alejandro Weinstein <
> I get a warning when I use IPython to run a script that import the gtk
> module. I have the following file:
> ###### foo.py #######
> import gtk
> ### end of file #####
> If I do
> $ ipython foo.py
> In : %run foo.py
> I get the warning
> /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:54: Warning:
> ignoring sys.argv: it must be a list of strings
> Running the script with the standard python interpreter ($ python
> foo.py) produce no warning. Also, if I do the 'import gtk' inside
> IPython (instead of running the script with %run), I get no warning.
> I have a fresh install of Lubuntu 10.10 and IPython 0.11 (installed using
> Any idea about how to avoid the warning?
This is a bug in 0.11, where we allowed sys.argv to be unicode strings, and
has been fixed in master by PR #898<https://github.com/ipython/ipython/pull/898>
It should be fairly easy to backport the fix to 0.11 (not quite trivial, as
the py3compat file where the cast_bytes function is defined was introduced
post-0.11, but it is a tiny function), but If you use master, it should
work. I can reproduce the warning on 0.11, and do not see it on master.
A one-liner to install a current snapshot of IPython master with
$> pip install [--user] https://github.com/ipython/ipython/tarball/master
> IPython-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User