[Tutor] unsupported operand
bodsda at googlemail.com
bodsda at googlemail.com
Sat Dec 17 23:11:34 CET 2011
I would suggest a few things, like variable naming style consistency or the unused file that you open and close. You also have an unused lw variable, and does dpi really need to be a variable? Its only used once, why not hard code it.
But the main thing I suggest, is posting the 'complete' traceback, so we can see what caused the error. I'm gonna take a wild guess at it being the pyplot.plot call though, due to the data types that its moaning about.
Bodsda
Sent from my BlackBerry® wireless device
-----Original Message-----
From: stm atoc <stm.at.oc at googlemail.com>
Sender: tutor-bounces+bodsda=googlemail.com at python.org
Date: Sat, 17 Dec 2011 21:30:17
To: tutor<Tutor at python.org>
Subject: [Tutor] unsupported operand
Hi there,
I would like to define concentration array based on time and then plot it.
Here is the profile:
from pylab import *
import numpy
import array
import math
tmax=1*3600
t = 1.
outfile=open('ourtest_out.list','w')
N = 100
Conc1 = arange([0, tmax])
outfile.close()
lw = 2.0 #linewidth
dpi = 96
figure(figsize=(12,6),dpi=dpi)
pyplot.plot(Conc1, t,'r-',label='Conc' )
savefig('Conc.png')
show()
and this is the error that I got:
TypeError: unsupported operand type(s) for -: 'list' and 'int'
What would you suggest?
Thank you,
Sue
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list