glederrey / camogen

Generator of random camouflage
MIT License
49 stars 16 forks source link

[BUG] instance issue with the add_vertices function in poligon.py [Doesn't run with python2] #1

Closed Syr3L closed 5 years ago

Syr3L commented 6 years ago

Hi!

When i execute the examples.py (also checked if it changes if i give all the files +x rights but it does not help at all)

here is a putty extract of the errors i get:

Traceback (most recent call last):
  File "./examples.py", line 19, in <module>
    image = camogen.generate(parameters)
  File "/home/camogen/master/camogen/generate.py", line 167, in generate
    starting_polygon.add_vertices(first_vertices)
  File "/home/camogen/master/camogen/polygon.py", line 69, in add_vertices
    raise ValueError( "Vertex: ",v," Type:",type(v).__name__," List: ",vs)
ValueError: (
    'Vertex: ', <camogen.vertex.Vertex instance at 0x7fbeeb70d050>,
    ' Type:', 'instance',
    ' List: ', [
        <camogen.vertex.Vertex instance at 0x7fbeeb70d050>,
        <camogen.vertex.Vertex instance at 0x7fbeeb70d098>, 
        <camogen.vertex.Vertex instance at 0x7fbeeb70d0e0>, 
        <camogen.vertex.Vertex instance at 0x7fbeeb70d128>
    ])

I've modified the errorValue to print the contents of v, vs and the type to get an idea of whats happening

I'm not familiar with python at all so if you could tell me whats wrong would be apprichiated

Setup is: Ubuntu 16.04 LTS Linux OS Installed Numpy like described in their Installation Documentation with a Debian / Ubuntu Arch using apt as Package-Manager

for me it seems it can't get a hold of the contents of the variables

Am I missing something?

glederrey commented 6 years ago

Hi,

I cannot reproduce your error. I'm running it on elementary OS Loki (built on top of Ubuntu 16.04) with python 3.6.1. Can you run this command in your terminal and copy-paste the results here: python -V. I'm pretty sure that you're using python 2.7.X and it seems that the code only works with python3.

I just lanched the code using python 2.7.12 and I received the following error:

Traceback (most recent call last):
  File "examples.py", line 19, in <module>
    image = camogen.generate(parameters)
  File "/home/gayouf/Documents/Other/camogen/camogen/generate.py", line 167, in generate
    starting_polygon.add_vertices(first_vertices)
  File "/home/gayouf/Documents/Other/camogen/camogen/polygon.py", line 68, in add_vertices
    raise ValueError("Element should be of the class Vertex")
ValueError: Element should be of the class Vertex

It seems to be the error you got before updating the error message.

For the moment, I suggest you to install python3 and use this version to run the code. If you need help to install it, tell me. I'll add a TODO to update the code in order to make it work with python2.

Best

Syr3L commented 6 years ago

You where right its Python 2.7.12 interesting - and i also suspected a wrong verson of python (suspected i have to youse an older version thou) I give python3 a go and give you the results

strange ...

apt install python3 says this: python3 is already the newest version (3.5.1-3).

EDIT:

ok I removed python 2.7 made apt autoremove installed numpy with pip installed images with pip

now its all working!!

thanks man you are awesome