Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83472

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

Date 2015-01-09 17:23 -0500
From Dave Angel <davea@davea.name>
Subject Re: Generate jpg files using line length (pixels) and orientation (degrees)
References (1 earlier) <m8mv27$k6e$2@dont-email.me> <m8nfs8$k6e$3@dont-email.me> <1ae2a5c4-78ae-4831-ac01-b886e92c0468@googlegroups.com> <mailman.17538.1420827512.18130.python-list@python.org> <6356e045-835c-4b87-bdce-59c8f3d8bc2c@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.17543.1420842214.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 01/09/2015 04:51 PM, semeon.risom@gmail.com wrote:
> On Friday, 9 January 2015 12:18:46 UTC-6, Joel Goldstick  wrote:
>> On Fri, Jan 9, 2015 at 12:49 PM,  <semeon...@gmail.com> 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:
             a.append(float(row[0]))
             b.append(float(row[1]))

>>
>> 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 corr.py", line 68, in <module>
>      makeimg(length, orientation)
>    File "C:\Users\Owner\Desktop\Stimuli Generation\Coordinates\Generate_w corr.py", 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.


-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Generate jpg files using line length (pixels) and orientation (degrees) semeon.risom@gmail.com - 2015-01-08 09:09 -0800
  Re: Generate jpg files using line length (pixels) and orientation (degrees) Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-08 22:07 +0000
    Re: Generate jpg files using line length (pixels) and orientation (degrees) Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-09 02:54 +0000
      Re: Generate jpg files using line length (pixels) and orientation (degrees) semeon.risom@gmail.com - 2015-01-09 09:49 -0800
        Re: Generate jpg files using line length (pixels) and orientation (degrees) Joel Goldstick <joel.goldstick@gmail.com> - 2015-01-09 13:18 -0500
          Re: Generate jpg files using line length (pixels) and orientation (degrees) semeon.risom@gmail.com - 2015-01-09 13:51 -0800
            Re: Generate jpg files using line length (pixels) and orientation (degrees) Dan Sommers <dan@tombstonezero.net> - 2015-01-09 22:21 +0000
            Re: Generate jpg files using line length (pixels) and orientation (degrees) Dave Angel <davea@davea.name> - 2015-01-09 17:23 -0500
            Re: Generate jpg files using line length (pixels) and orientation (degrees) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-09 22:41 +0000
        Re: Generate jpg files using line length (pixels) and orientation (degrees) Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-11 00:32 +0000
          Re: Generate jpg files using line length (pixels) and orientation (degrees) semeon.risom@gmail.com - 2015-01-11 11:41 -0800
            Re: Generate jpg files using line length (pixels) and orientation (degrees) Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-11 19:56 +0000
            Re: Generate jpg files using line length (pixels) and orientation (degrees) Dave Angel <davea@davea.name> - 2015-01-11 15:16 -0500

csiph-web