CGTalk > Software Specific Forums > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-16-2010, 02:35 PM   #1
ade90054
Frequenter
.
Animator
United Kingdom
 
Join Date: Apr 2002
Posts: 123
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-16-2010, 02:38 PM   #2
NaughtyNathan
HighEnd3D deserter
 
NaughtyNathan's Avatar
Naughty Nathan
Technical Artist
Sony SCEE Liverpool
Manchester, United Kingdom
 
Join Date: May 2008
Posts: 2,608
you are just referencing the function object, you want to CALL the function, so need to add brackets:

joSceneName.long()
:nathaN
 
Old 07-16-2010, 03:06 PM   #3
ade90054
Frequenter
.
Animator
United Kingdom
 
Join Date: Apr 2002
Posts: 123
Ta :)

Oh man, now I feel dumb, lol!!

Thanks bud.
__________________
1.21 gigawatts!
 
Old 07-16-2010, 03:06 PM   #4
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:53 PM.


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