Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

NameError when using PVector in a separate module #13

Closed
jarav opened this Issue · 5 comments

3 participants

@jarav

This is just my follow-up comment on the previous issue, in case you hadn't looked at it. If I use PVector in a separate module( which I import in the main module) I get a NameError. This is why I had to resort to "import processing.core.PVector as PVector".

@jdf
Owner

Ahh! Now I see the problem. OK, this is a serious bug, and I'll see what i can do about it.

@jeisenma

I'm encountering the same problem. Any progress on this bug?

Even when I import PVector into the separate module (as described by jarav), a strange thing happens... This sequence of PVector operations:

a = PVector()
b = PVector(1,0)
x = PVector.sub( a, b )
x.mult(5)

...yields this error for x:

AttributeError: 'NoneType' object has no attribute 'mult'

I suspect that the PVector. methods aren't returning a PVector object. However this works fine in the main file.

@jdf jdf closed this in 8f86b03
@jdf
Owner
jdf commented

Hooray!

@jdf
Owner
jdf commented

For those interested, you should no longer import PVector yourself. I don't even know what will happen if you try.

PVector is now a builtin name, as far as Jython is concerned, in the context of your sketch. It's magical.

@jeisenma

It IS magical. Thanks very much!

@ralfbiedert ralfbiedert referenced this issue from a commit in ralfbiedert/processing.py
@jdf Fix #13: PVector doesn't work in imported modules. 9eba479
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.