Re: Global Python interpreter?

2013-10-27 Thread Aloys Baillet
Just create an empty python file called "storage.py" and place it in one of the folders in your PYTHONPATH. (or add with sys.path.append('pathto/storage.py') Then when you need to store stuff globally: import storage storage.myStuff = {'test': 'stuff'} # later or from other tab: import storage pr

Re: Global Python interpreter?

2013-10-22 Thread Alok Gandhi
I think it can be done with some tricks. The inspect module does not work directly on the script editor code because of the way python is implemented in softimage. With some wizardry, what can be done though is to grab the current file path directly from the layout views of the script editor. Once

Re: Global Python interpreter?

2013-10-22 Thread Luc-Eric Rousseau
Having one unified python environment and interactively modifying it is brilliant. it was brilliant when SmallTalk did it, and it's still brilliant today. Nothing in softimage is implemented directly in python, it's all in c++ wrapped with python, so you can't see the benefit because you're not d

Re: Global Python interpreter?

2013-10-22 Thread Chris Chia
Having used Maya in the past, storing global variables for uses in other sessions of python is more like an ugly hack which many should avoid using. Even though it is quite useful, it could also be dangerous too. Chris On 22 Oct, 2013, at 9:38 PM, Sergio Mucino wrote: > The thing is that the

Re: Global Python interpreter?

2013-10-22 Thread Sergio Mucino
The thing is that the data I tend to keep at the global level I usually need it briefly, and I tend to change it quite often. I use it more for development, not for actual steady access, so having to go through files and load them into memory is just a bit more trouble fo

Re: Global Python interpreter?

2013-10-22 Thread Sergio Mucino
Being frank, I've never had any problems with how Maya/Max handle this, and it just allows me to work faster while developing stuff. I'm not saying it's better than how SI works, just more convenient for me. I guess I'll find my way around it. On 21/10/20

Re: Global Python interpreter?

2013-10-22 Thread Peter Agg
Whilst I prefer Soft's approach in general it would still be nice to have * some* kind of access to global python objects. In a couple of moments of madness I've even taken to using pickle and the Set/GetGlobal commands. On 22 October 2013 00:57, Chris Chia wrote: > I know this is a bit foolish

Re: Global Python interpreter?

2013-10-21 Thread Chris Chia
I know this is a bit foolish suggestion which is to write your global data (in py format) to a temp file on disk. Then load that file as a py file. This is a quick workaround. Chris On 22 Oct, 2013, at 5:46 AM, Raffaele Fragapane wrote: > To be perfectly honest I'm still on the fence about

Re: Global Python interpreter?

2013-10-21 Thread Raffaele Fragapane
To be perfectly honest I'm still on the fence about that behaviour. In some ways it's nice, and it's relatively easier to debug Maya live because of it than it is Softimage. On the other hand multiple runs and coarsely grained iterations tend to pollute the environment beyond belief, and God forbi

Re: Global Python interpreter?

2013-10-21 Thread Sergio Mucino
Thanks Raffaele. Yes, in both applications I've used (Maya and Max) this is how it works. Any functions and variables I declare or define at the global scope remain in memory throughout the session. This makes it very easy to iterate over different version of tool develop

Re: Global Python interpreter?

2013-10-20 Thread Raffaele Fragapane
I might have been unclear, sorry. No, it won't work across tabs of course, but it gets closer to Maya's way of working within each tab (which I understand is where Sergio comes from), and it allows to expand or contract module functionality on the fly. For it to work across different interpreters y

Re: Global Python interpreter?

2013-10-18 Thread Jon Swindells
i have to admit confusion on this topic too. to be able to push your temp module onto pythons sys you'd need a constantly running instance surely ? python cmd line in the background seems a trifle silly (if that is what's needed) when you might as well just make a command and have done with it

Re: Global Python interpreter?

2013-10-18 Thread Luc-Eric Rousseau
On Thu, Oct 17, 2013 at 6:22 PM, Raffaele Fragapane wrote: > If you want something to be available across the board you can simply write > it, register it as a module, and push it. No need for it to exist as a file. I've read the link, but I can't see how you could use this to push functions to

Re: Global Python interpreter?

2013-10-17 Thread Raffaele Fragapane
Django extensively uses a lot of Python tricks, as you'd expect from such a Python centric project :) As such, it's usually worth dissecting for inspiration regularly. I haven't looked at it in a while actually, but it until a couple years ago it did a fair bit of both, magic pattern for the plugin

Re: Global Python interpreter?

2013-10-17 Thread Alok Gandhi
As far as I know Django extensively employs python meta classes for the magic stuff. Python Meta Class concept is extremely powerful in case one is curious enough to learn it. Alok. Sent from my iPhone > On Oct 17, 2013, at 6:22 PM, Raffaele Fragapane > wrote: > > I'm sure you're used to Ma

Re: Global Python interpreter?

2013-10-17 Thread Sergio Mucino
Thanks a lot guys! I'll check this out. Cheers all! On 17/10/2013 6:22 PM, Raffaele Fragapane wrote: I'm sure you're used to Maya, where the environment gets cluttered with anything and everything you run, in XSI as Steve mentioned you get

Re: Global Python interpreter?

2013-10-17 Thread Raffaele Fragapane
I'm sure you're used to Maya, where the environment gets cluttered with anything and everything you run, in XSI as Steve mentioned you get a clean engine every tab, every run. Good and bad to it (personally I find it generally more good than bad compared to a constantly and unpredictably stale envi

Re: Global Python interpreter?

2013-10-17 Thread Alok Gandhi
<<< text/html; charset=ISO-8859-1: Unrecognized >>> <><>

RE: Global Python interpreter?

2013-10-17 Thread Marc-Andre Belzile
Use a command ? From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Sergio Mucino Sent: Thursday, October 17, 2013 2:50 PM To: softimage@listproc.autodesk.com Subject: Re: Global Python interpreter? Thanks Stephen. That would work for

Re: Global Python interpreter?

2013-10-17 Thread Sergio Mucino
Thanks Stephen. That would work for stuff I want to keep around and re-use, but sometimes, I'm just doing quick-n-dirty work where I would like to define a function, and then be able to call it whenever I want. Use-n-dispose, I guess. I can do that just fine in other apps

Re: Global Python interpreter?

2013-10-17 Thread Stephen Blair
That's right, Softimage is always creating new and separate instances of the scripting engine to run code. There isn't a way to add global code that Softimage will insert into every new instance of the scripting engine. So, maybe put that code in a module, or in a special custom command that you k