Weave broken in Sage 4.1 Mac intel 64 bit

37 views
Skip to first unread message

felix

unread,
Aug 20, 2009, 12:02:42 PM8/20/09
to sage-support
Hi,

this should have happened to other people, but I can't find some other
post on this one. I'm not sure which update exactly caused the bug,
since I didn't use weave since Sage 3.something. All I can say is,
that weave doesn't work at all in Sage 4.1 and 4.11 (64 bit) under Mac
OS X 10.5.8 on my MacBook Pro Unibody rev. A. It used to work fine
before.

Weave doesn't even try to compile anything anymore it just produces a
KeyError:

>>> from scipy import weave
>>> weave.inline("""printf("hello");""")

File "<stdin>", line 1, in <module>
File "/Users/felix/Documents/uni/Promotion/sagenotebooks/
critical_control/worksheets/admin/43/code/27.py", line 7, in <module>
weave.inline("""printf("hello");""")
File "", line 1, in <module>

File "/Applications/sage/local/lib/python2.6/site-packages/scipy/
weave/inline_tools.py", line 321, in inline
results = attempt_function_call(code,local_dict,global_dict)
File "/Applications/sage/local/lib/python2.6/site-packages/scipy/
weave/inline_tools.py", line 389, in attempt_function_call
function_list = function_catalog.get_functions(code,module_dir)
File "/Applications/sage/local/lib/python2.6/site-packages/scipy/
weave/catalog.py", line 612, in get_functions
function_list = self.get_cataloged_functions(code)
File "/Applications/sage/local/lib/python2.6/site-packages/scipy/
weave/catalog.py", line 526, in get_cataloged_functions
if cat is not None and code in cat:
File "/Applications/sage/local/lib/python/shelve.py", line 110, in
__contains__
return key in self.dict
File "/Applications/sage/local/lib/python2.6/site-packages/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

Also weave.test() fails:

Running unit tests for scipy.weave
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/felix/Documents/uni/Promotion/sagenotebooks/
critical_control/worksheets/admin/43/code/29.py", line 7, in <module>
weave.test()
File "", line 1, in <module>

File "/Applications/sage/local/lib/python2.6/site-packages/numpy/
testing/nosetester.py", line 242, in test
self._show_system_info()
File "/Applications/sage/local/lib/python2.6/site-packages/numpy/
testing/nosetester.py", line 149, in _show_system_info
nose = import_nose()
File "/Applications/sage/local/lib/python2.6/site-packages/numpy/
testing/nosetester.py", line 49, in import_nose
raise ImportError(msg)
ImportError: Need nose >= 0.10.0 for tests - see
http://somethingaboutorange.com/mrl/projects/nose


Any help on this issue would be very appreciated.

- Felix

William Stein

unread,
Aug 20, 2009, 12:24:31 PM8/20/09
to sage-s...@googlegroups.com
On Thu, Aug 20, 2009 at 9:02 AM, felix<fe...@neuro.uni-bremen.de> wrote:
>
> Hi,
>
> this should have happened to other people, but I can't find some other
> post on this one.

I wonder if there is almost nobody using Sage who also uses weave?
I've never used weave, and we use it nowhere in the Sage codebase.
As a result of this, you may consider also asking your question below
on the scipy list if nobody here has anything useful to say (like me
just now).
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Robert Bradshaw

unread,
Aug 25, 2009, 3:09:08 AM8/25/09
to sage-s...@googlegroups.com
On Aug 20, 2009, at 9:02 AM, felix wrote:

> Hi,
>
> this should have happened to other people, but I can't find some other
> post on this one. I'm not sure which update exactly caused the bug,
> since I didn't use weave since Sage 3.something. All I can say is,
> that weave doesn't work at all in Sage 4.1 and 4.11 (64 bit) under Mac
> OS X 10.5.8 on my MacBook Pro Unibody rev. A. It used to work fine
> before.

I wonder if this broke in the upgrade to 2.6. The errors below mean
nothing to me, but maybe a scipy expert would know their cause.

- Robert

felix

unread,
Sep 7, 2009, 12:47:27 PM9/7/09
to sage-support
Hi again,


it seems like scipy 7.1 is supposed to work with python 2.6 while
previous versions aren't. At least on sourceforge (http://
sourceforge.net/projects/scipy/files/), older scipy superpacks that
come with their own python only include python 2.5 or 2.4.
Furthermore, there are tickets regarding broken scipy 0.7.0 packages
when using python 2.6 which have been fixed since.

The sage packet index lists scipy 0.7.p2 whatever that means. Is this
supposed to be the latest version?

I haven't tried to compile sage with another version of scipy, I'm
currently just switching to sage 4.0.1 when I intend to use weave (I
only use it to test code fragments before I build proper extensions)
which is currently good enough for me to get my work done.

- Felix


On 25 Aug., 09:09, Robert Bradshaw <rober...@math.washington.edu>
wrote:
Message has been deleted

felix

unread,
Sep 10, 2009, 7:17:51 AM9/10/09
to sage-support
Hi,

I just got a trac account and create the ticket at
http://trac.sagemath.org/sage_trac/ticket/6914 .
By the Way: I verified, that the problem is also present with the 32
bit mac intel binary.

- Felix

Emmanuel Lambert

unread,
Sep 21, 2009, 2:48:26 PM9/21/09
to sage-support
Hi,

Has anyone a solution for the KeyError problem in Weave?

We encounter the same KeyError problem with SciPy (0.7.1) -weave on
Scientific Linux / Python 2.6.
After investigation, it turns out that some of the unit tests
delivered with Scipy-Weave also fail with the same error.
Below is a list of tests that fail in for example the "test_c_spec"
file. They all raise a KeyError.

I downloaded the latest Weave code again from the SVN repository
(trunk), but the problem is not
resolved.

Any idea on how to tackle this problem? There are no posts that help
me further other than this one. I don't have this problem with the
Debian package of scipy that is available for Ubuntu 9.04 (apparently
the weave version number is the same).

It looks like the compilation that weave triggers works fine, see
sample stdout also below.

What could cause this? Is there a patch available?

thanks for any help.
Emmanuel

******************* SAMPLE OF STDOUT (compilation by weave)
******************

-------------------- >> begin captured stdout << ---------------------
<weave: compiling>
running build_ext
running build_src
building extension "sc_d133102ab45193e072f8dbb5a1f6848513" sources
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'sc_d133102ab45193e072f8dbb5a1f6848513' extension
compiling C++ sources
C compiler: g++ -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3
-
Wall -fPIC

compile options: '-I/user/home/gent/vsc401/vsc40157/scipy-runtime/
scipy/weave -I/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/
weave/scxx -I/user/home/gent/vsc401/vsc40157/numpy-runtime/numpy/core/
include -I/apps/gent/gengar/harpertown/software/Python/2.6.2-
gimkl-0.5.0/include/python2.6 -c'
g++: /user/home/gent/vsc401/vsc40157/.python26_compiled/
sc_d133102ab45193e072f8dbb5a1f6848513.cpp
g++ -pthread -shared /tmp/vsc40157/python26_intermediate/
compiler_c1b5f1b73f1ce7d0c836cdad4c7c5ded/user/home/gent/vsc401/
vsc40157/.python26_compiled/sc_d133102ab45193e072f8dbb5a1f6848513.o /
tmp/vsc40157/python26_intermediate/
compiler_c1b5f1b73f1ce7d0c836cdad4c7c5ded/user/home/gent/vsc401/
vsc40157/scipy-runtime/scipy/weave/scxx/weave_imp.o -o /user/home/
gent/
vsc401/vsc40157/.python26_compiled/
sc_d133102ab45193e072f8dbb5a1f6848513.so
running scons

--------------------- >> end captured stdout << ----------------------


********************** TESTS THAT FAIL ***********************

-bash-3.2$ python ./test_c_spec.py
E..........EE.................EEEE......E..........EE.................EEEE..............
======================================================================
ERROR: test_call_function (test_c_spec.CallableConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 296, in test_call_function
compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_file_to_py (test_c_spec.FileConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 262, in test_file_to_py
force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_py_to_file (test_c_spec.FileConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 246, in test_py_to_file
inline_tools.inline(code,['file'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_dict (test_c_spec.SequenceConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 305, in test_convert_to_dict
inline_tools.inline("",['d'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_list (test_c_spec.SequenceConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 309, in test_convert_to_list
inline_tools.inline("",['l'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_string (test_c_spec.SequenceConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 313, in test_convert_to_string
inline_tools.inline("",['s'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_tuple (test_c_spec.SequenceConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 317, in test_convert_to_tuple
inline_tools.inline("",['t'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_call_function (test_c_spec.TestCallableConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 296, in test_call_function
compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_file_to_py (test_c_spec.TestFileConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 262, in test_file_to_py
force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_py_to_file (test_c_spec.TestFileConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 246, in test_py_to_file
inline_tools.inline(code,['file'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_dict (test_c_spec.TestSequenceConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 305, in test_convert_to_dict
inline_tools.inline("",['d'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_list (test_c_spec.TestSequenceConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 309, in test_convert_to_list
inline_tools.inline("",['l'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_string (test_c_spec.TestSequenceConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 313, in test_convert_to_string
inline_tools.inline("",['s'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

======================================================================
ERROR: test_convert_to_tuple (test_c_spec.TestSequenceConverterUnix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
tests/test_c_spec.py", line 317, in test_convert_to_tuple
inline_tools.inline("",['t'],compiler=self.compiler,force=1)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
inline_tools.py", line 301, in inline
function_catalog.add_function(code,func,module_dir)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 648, in add_function
self.cache[code] = self.get_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 615, in get_functions
function_list = self.get_cataloged_functions(code)
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/weave/
catalog.py", line 529, in get_cataloged_functions
if cat is not None and code in cat:
File "/apps/gent/gengar/harpertown/software/Python/2.6.2-gimkl-0.5.0/
lib/python2.6/shelve.py", line 110, in __contains__
return key in self.dict
File "/user/home/gent/vsc401/vsc40157/scipy-runtime/scipy/io/
dumbdbm_patched.py", line 73, in __getitem__
pos, siz = self._index[key] # may raise KeyError
KeyError: 0

----------------------------------------------------------------------
Ran 88 tests in 32.581s

FAILED (errors=14)


On 20 aug, 18:02, felix <fe...@neuro.uni-bremen.de> wrote:
> Hi,
>
> this should have happened to other people, but I can't find some other
> post on this one. I'm not sure which update exactly caused the bug,
> since I didn't useweavesince Sage 3.something. All I can say is,
> thatweavedoesn't work at all in Sage 4.1 and 4.11 (64 bit) under Mac
> OS X 10.5.8 on my MacBook Pro Unibody rev. A. It used to work fine
> before.
>
> Weavedoesn't even try to compile anything anymore it just produces a
> KeyError:
>
> >>> from scipy importweave
> >>>weave.inline("""printf("hello");""")
>
>   File "<stdin>", line 1, in <module>
>   File "/Users/felix/Documents/uni/Promotion/sagenotebooks/
> critical_control/worksheets/admin/43/code/27.py", line 7, in <module>
>    weave.inline("""printf("hello");""")
>   File "", line 1, in <module>
>
>   File "/Applications/sage/local/lib/python2.6/site-packages/scipy/weave/inline_tools.py", line 321, in inline
>     results = attempt_function_call(code,local_dict,global_dict)
>   File "/Applications/sage/local/lib/python2.6/site-packages/scipy/weave/inline_tools.py", line 389, in attempt_function_call
>     function_list = function_catalog.get_functions(code,module_dir)
>   File "/Applications/sage/local/lib/python2.6/site-packages/scipy/weave/catalog.py", line 612, in get_functions
>     function_list = self.get_cataloged_functions(code)
>   File "/Applications/sage/local/lib/python2.6/site-packages/scipy/weave/catalog.py", line 526, in get_cataloged_functions

Aku Kotkavuo

unread,
Sep 24, 2009, 10:34:06 PM9/24/09
to sage-support


On Sep 21, 9:48 pm, Emmanuel Lambert <elamb...@gmail.com> wrote:
> Hi,
>
> Has anyone a solution for the KeyError problem in Weave?

Hello. I also came across this problem (scipy 0.7.1 and 32 bit Mac OS
X) and found a simple solution. You need to apply the following patch
to the file scipy/io/dumbdb_patched.py:

--- dumbdbm_patched.py 2009-09-25 05:28:21.000000000 +0300
+++ dumbdbm_patched_fixed.py 2009-09-25 05:26:18.000000000 +0300
@@ -70,7 +70,10 @@
f.close()

def __getitem__(self, key):
- pos, siz = self._index[key] # may raise KeyError
+ try:
+ pos, siz = self._index[key] # may raise KeyError
+ except KeyError:
+ raise IndexError
f = _open(self._datfile, 'rb')
f.seek(pos)
dat = f.read(siz)

For some reason the code didn't handle the case where __getitem__ is
called for key that is out of bounds. Maybe __getitem__'s expected
behaviour has changed in Python 2.6 or something. Anyways, with this
change I got weave.inline working again (both the toy example in this
thread and my own project).

Jason Grout

unread,
Sep 24, 2009, 11:39:22 PM9/24/09
to sage-s...@googlegroups.com


Do the scipy people know about this?

Jason


--
Jason Grout

felix

unread,
Oct 22, 2009, 5:56:29 AM10/22/09
to sage-support
Hi,

just came back to check for any progress in this thread. Tried your
patch and it seems to work fine for me.

Thanks a lot,
Felix
Reply all
Reply to author
Forward
0 new messages