[Tutor] python 3 np.savetxt(name_s, I_z) produces IndexError: tuple index out of range

Alan Gauld alan.gauld at yahoo.co.uk
Thu May 11 16:59:30 EDT 2017


On 11/05/17 20:46, Stephen P. Molnar wrote:

>> script uses the np.savetxt() quite a few times, but one use generates
>> the title error. The offending line is np.savetxt(name_s,I_z) where I_z
>> is a single number of type float64 with a size of 1.

I'm glad you found the problem but please, when you post,
do NOT summarize the error.

Always, always, send the full error trace, there is a wealth
of data in those messages and if we only get your best guess
at what they mean we are deprived of essential clues in
diagnosing problems.

> Problem solved: np.savetxt(name_s,I_z) should be np.savetxt(name_s,[I_z])

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list