1

Greetings,

I have come across an interesting error and was wondering if anyone knew the cause.

I create several numpy arrays of dtype object and wish to initialize them with empty strings, so I did the following to create them:

txtInputs=empty((7,12), dtype=object)
txtInputs[:, :]=''

repeated...

How they are used after is not relevant other than that these variables are local to the function and are gone when it returns. However, I have discovered that when I call the function that does this many times in a row, my program crashes with an error saying pythonw.exe has stopped working. This crash is consistent and happens after a specific number of calls, and that number never changes.

However, if I replace the second line with:

txtInputs.fill('')

It will not crash. What is wrong with using [:,:]='' to fill the numpy array??

Thank you.

PS. I am using python 2.5 and numpy 1.0.4

2
  • Just a note, sometimes it gives me a C++ Runtime Library error and other times it just says pythonw.exe has stopped working. So it does seem to point to windows only... Mar 17, 2011 at 15:08
  • 1
    I asked mainly out of curiosity -- there have been 9 NumPy releases since 1.0.4. Another reason for asking is that I don't have access to such an old version of NumPy, so I can't reproduce your problem. If this is a NumPy problem, chances are it has been fixed meanwhile, but I don't know if it is a NumPy problem. Mar 17, 2011 at 16:06

1 Answer 1

4

This error does not occur with numpy 1.5.1. We were fixing quite a few bugs around the time of numpy 1.0.4, particularly with the object and string dtypes. This is probably one of them. The bug has apparently been fixed since then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.