> > I see... For most functions and classes you don't need to reference > the module in this way, correct? How do I tell when it's needed? And > when would I use "vector" without the module name, as it is in the > docs?
i'll correct the doc examples so as not to mislead. this is from the section in the docs on namespaces: "Even though PyMEL has many sub modules, all but pymel.runtime, pymel.api, pymel.util, and pymel.datatypes are imported into the PyMEL namespace. The sub-modules are provided primarily to improve the clarity of the documentation." > > On Apr 7, 11:59 pm, Chad Dombrova <[email protected]> wrote: >> hey peter, >> >> datatypes are kept in their own module to protect them from clashing >> with nodes. For example, there's a Time node and a Time data type. >> >> from pymel import * >> v1 = datatypes.Vector(1,2,3) >> v2 = datatypes.Vector(2,2,2) >> v1.dot(v2) >> >> On Apr 7, 2009, at 6:13 PM, pjrich wrote: >> >> >> >>> Hi all -- I'm new to both Python and Pymel, so I'm not sure where my >>> problem lies: >> >>>>>> A = (1,1,1) >>>>>> B = (2,2,2) >>>>>> dot(A,B) >>> # Error: can't multiply sequence by non-int of type 'tuple' >>> # Traceback (most recent call last): >>> # File "<maya console>", line 3, in <module> >>> # File "[snip]\pymel\util\arrays.py", line 6534, in dot >>> # return reduce(lambda x, y: x+y, a*b, 0.) >>> # TypeError: can't multiply sequence by non-int of type 'tuple' # >> >>> And I can't seem to cast anything specifically as a vector: >> >>>>>> A = vector(1,1,1) >>> # Error: name 'vector' is not defined >>> # Traceback (most recent call last): >>> # File "<maya console>", line 1, in <module> >>> # NameError: name 'vector' is not defined # >> >>> I see in the docs that there's a Vector class in the Pymel core, >>> but I >>> can't get the examples in there to work either -- do I still need to >>> include something somewhere? >> >>> Thanks! >>> Peter > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
