Small Python error?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 07 July 2010   #1
Small Python error?

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:

Code:
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:

Code:
import joSceneName


and then type:

Code:
joSceneName.long


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


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

Cheers.
__________________
1.21 gigawatts!
 
Old 07 July 2010   #2
you are just referencing the function object, you want to CALL the function, so need to add brackets:

joSceneName.long()
:nathaN
 
Old 07 July 2010   #3
Ta :)

Oh man, now I feel dumb, lol!!

Thanks bud.
__________________
1.21 gigawatts!
 
Old 07 July 2010   #4
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:52 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.