New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psearch: TypeError: expected string or buffer #129
Comments
Right, from the debian bug report, the command that triggered this is
Specifically, the problem is in I'm attempting to find an elegant solution. |
The test, the fix, and the general tidy-up of the IPython.utils.wildcard module are in a sequence of commits at: |
closes ipythongh-129 closes ipythongh-251
allow nbconvert to run from anywhere
closes ipythongh-129 closes ipythongh-251
version: 0.10-2 (Debian sid)
original report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565351
I've ran into this issue many times and finally decided to report ;)
In [1]: import numpy
In [2]: %psearch numpy._._s
TypeError Traceback (most recent call last)
...
/usr/lib/pymodules/python2.5/IPython/wildcard.pyc in glob_filter(lista, name_pattern, hidehidden, ignore_case)
113 else:
114 reg=re.compile(pattern+"$")
--> 115 result=[x for x in lista if reg.match(x) and show_hidden(x,hidehidden)]
116 return result
117 ns=self._ns
TypeError: expected string or buffer
happens with
ipdb> p lista
[<type 'numpy.void'>, <type 'numpy.float128'>, 'f4', <type 'numpy.int8'>, 'f8', <type 'numpy.float64'>, 'Complex128', <type 'numpy.int32'>, <type 'numpy.int16'>, 'Bool', 'b1', <type 'numpy.string_'>, 'String0', 'q', <type 'numpy.complex64'>, 'Complex64', 'G', 'u4', <type 'numpy.int64'>, 'Unicode0', 'u1', <type 'numpy.complex128'>, 'u2', 'i1', 'UInt16', 'Float32', <type 'numpy.int64'>, 'Int64', <type 'numpy.complex256'>, 'c16', '?', 'Void0', <type 'numpy.bool_'>, 'i8', <type 'numpy.uint8'>, 'B', 'D', <type 'numpy.object_'>, 'F', 'I', 'H', 'i2', <type 'numpy.uint16'>, 'L', 'O', 'i4', 'Q', 'S', 'c8', 'U', 'Int8', 'Complex32', 'V', <type 'numpy.uint32'>, <type 'numpy.unicode_'>, 'u8', 'UInt64', 'Float64', 'b', 'd', 'g', 'f', 'i', 'h', 'UInt8', 'l', 'UInt32', 'Object0', <type 'numpy.uint64'>, 'Float128', <type 'numpy.uint64'>, 'c32', 'f16', 'Int16', <type 'numpy.float32'>, 'Int32']
ipdb> reg.match(lista[0])
*** TypeError: expected string or buffer
I guess safest way would be to check first if x is a string at all ;)
The text was updated successfully, but these errors were encountered: