Generate jpg files using line length (pixels) and orientation (degrees)

Dave Angel davea at
Fri Jan 9 23:23:19 CET 2015

On 01/09/2015 04:51 PM, semeon.risom at wrote:
> On Friday, 9 January 2015 12:18:46 UTC-6, Joel Goldstick  wrote:
>> On Fri, Jan 9, 2015 at 12:49 PM,  <semeon... at> wrote:

(double-spaced nonsense mostly trimmed)

>> i = 0
>> a = []
>> b = []

What are a and b supposed to contain?   Please use more informative 
names for them.  it looks like they are intended to be lists of floats, 
but you're then stuffing them with strings.

>> for row in rdr:
>>          a.append(row[0])
>>          b.append(row[1])

perhaps something like:

>> def makeimg(length, orientation):

Probably should add some type checking here, since you're having 
repeated errors.

         if type(length) not is float or type(orientation) not is float:
                    .....  some educational error message showing what 
the types and values actually are.....

Note I'm NOT recommending you code it this way.  Just add the check till 
you've narrowed down the errors.


> Unfortunately getting a new error.
> Traceback (most recent call last):
>    File "C:\Users\Owner\Desktop\Stimuli Generation\Coordinates\Generate_w", line 68, in <module>
>      makeimg(length, orientation)
>    File "C:\Users\Owner\Desktop\Stimuli Generation\Coordinates\Generate_w", line 40, in makeimg
>      orientation = orientation % 180
> TypeError: not all arguments converted during string formatting

I think that's because the % operator means an entirely different thing 
if orientation is mistakenly passed as a string.


More information about the Python-list mailing list