Justin, thanks for the idea of using pickle, i guess now I have got the direction, the process could be little time consuming for me but I am totally going to give it, yes you are right the getCams() function should not print but there i was experimenting to check if I can get correct result , and writing an intermediate py file that does the import was little but if idiotic on my part when instead I could directly go "mayapy "+readMayaFile.py which will execute it from interpreter.
you weren't hurting at all, instead I thank you for hinting, this did turned out to be snowball:/ I agree but now I have got a clear vision to proceed further. On Sun, Dec 9, 2012 at 12:23 PM, Justin Israel <[email protected]>wrote: > This is all getting pretty obscure. I honestly don't know if I am helping > or hurting at this point, but I will simply comment on what I see. > > You are both printing and returning values from your getCams() > Then you have some temporary intermediate file that is actually importing > and running this function, but the only thing that happens is it indirectly > triggers that print statement, even though the getCams() could just return > the value, and you intermediate file could do what it needs to do with the > results. > > I guess I would say that getCams() should not print anything. Just return > its values, and continue to act as a pure library function. What ever is > calling it (your intermediate script) can do whatever is necessary with the > results to get them back up to your parent process. This could be printing > the results, which would require you to do an eval (not great, but it will > work). I suppose there are other things you could do like writing or > printing out pickle serialized format. > > At this point, it would definitely be a lot better if you could set up > your environment to simply import and use the maya modules so that you do > have to shell out to a subprocess. The subprocess is find if you just need > to run operations, but when you are going to be doing it a lot just to make > basic queries for return values, it is probably more complicated to need to > have an intermediate serialization process. If you see yourself needing to > do a lot of small maya operations and you want to keep it separate from > your UI app, maybe you can just wrap the command line utility into > something that returns results in JSON or pickle ascii so that you can call > out and get results easily. > > Not really sure where to do with it at this point. This thread has snow > balled into something quite larger than the original question :-) > > Any one else have some input? > > > > On Dec 8, 2012, at 9:00 PM, šãñ wrote: > > strRead > > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- ** [image: San's personal blog] <http://feeds.feedburner.com/SanLuthraBlog> * * -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
