PDA

View Full Version : Small Python error?


ade90054
07-16-2010, 03:35 PM
Hey all,

I'm just starting to dig into python and thought I would start by making something small as a quick test. This is what I've written:

import maya.cmds as mc

def long():
longName = mc.file(q=True, sceneName=True)
print longName

def short():
shortName = mc.file(q=True, sceneName=True, shortName=True)
print shortName

I then saved this as a file called "joSceneName.py"

I then type this in the script editor:

import joSceneName

and then type:

joSceneName.long

Now I thought this would work without a problem but unfortunately I get this error:
# Result: <function long at 0x1328F8B0> #

Any ideas as to what I've done wrong??

Cheers.

NaughtyNathan
07-16-2010, 03:38 PM
you are just referencing the function object, you want to CALL the function, so need to add brackets:

joSceneName.long()

:nathaN

ade90054
07-16-2010, 04:06 PM
Oh man, now I feel dumb, lol!!

Thanks bud.

CGTalk Moderation
07-16-2010, 04:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.