The execfile is just a standard python builtin :
https://docs.python.org/2/library/functions.html#execfile

The plugin uses it to create a namespace specifically for the plugin, and
execs the file under it to avoid affecting the main  namespace of Maya, and
to let it be persistent across calls.
https://github.com/justinfx/MayaSublime/blob/master/MayaSublime.py

On Mon, 23 Feb 2015 10:29 PM Lidia Martinez <darksideg...@gmail.com> wrote:

> Thanks!
>
> The solutions on changing : sys.dont_write_bytecode = True   won't work
> for me. The reason is that i'm deploying this code for production and at
> the same time i'm working on development. If i set that variable to true,
> then the people who use the tool will be reloading the code all the time,
> that is slower.
> If this was like C++ , where you can tell it to see if you are in a debug
> or release version... i guess that would be something to be added, a global
> variable in maya modified on the click of the shelf button, and have the
> button to test for developers and the released one... sounds quite shabby (
> i guess that's the word, i don't find a proper sinonym for spanish word
> "cutre" :) )
>
> About reloading first lower level modules that's a great idea. I'll test
> it.
>
> This is a multi module project. Some common parts are laying inside
> separate files. I find it hard to make the reloading process useful while
> developing and at the same time be able to deploy for the departments to
> use it without any problem.
>
> And about the mayaSublime plugin, that's what i'm using, but i also test
> the button itself, i inserted some import code on the execution.  That
> execfile and namespace stuff you told me, Justin, sounds interesting.
> Anywhere to search for more info?
>
>
>
>
>
>
> --
> Lidia
>
> 2015-02-20 19:53 GMT+01:00 Justin Israel <justinisr...@gmail.com>:
>
>> @damon: reload only works on modules, right?
>>
>> Usually when I run reload(), it takes care of loading from the py and not
>> a pyc (you can usually confirm this by running reload manually and seeing
>> the path it prints out).
>>
>> If your top level module imports other modules, whose source you are
>> changing, you would need to "deep reload" all of those. That means all of
>> the dependencies that changed have to be reloaded first, then the modules
>> depend on them have to be reloaded. We have had some topic on reloading in
>> the past, I think, with some extended info on this.
>>
>> Code within 'if __name__ == "__main__"' shouldn't get executed under
>> Maya. Is the particular project, for which you are having trouble, a single
>> module or a multi-module project? The MayaSublime plugin should allow you
>> to send the entire file for execution to Maya, in its own namespace. Have
>> you tried that out? It doesn't use the import mechanism, but rather does an
>> execfile on the source.
>>
>> On Sat Feb 21 2015 at 5:34:18 AM Marcus Ottosson <konstrukt...@gmail.com>
>> wrote:
>>
>>> If you print your module, you’ll see where it exists on disk, the .pyc
>>> file might lie right next to it. It’s also possible that you’ve got two
>>> modules with the same name in your PYTHONPATH, which would explain why you
>>> can import it, but not see the changes you make to the other one.​
>>> ​
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to python_inside_maya+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC0jpt2BypPrg3XjHUpcS%3DEExZPng7jT4Aj%2B_210KnWXg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC0jpt2BypPrg3XjHUpcS%3DEExZPng7jT4Aj%2B_210KnWXg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to python_inside_maya+unsubscr...@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA14%3DTZY4hB0F0i1RT9%2B66oagFVd95Q9z5PN_s-UGNE9fg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA14%3DTZY4hB0F0i1RT9%2B66oagFVd95Q9z5PN_s-UGNE9fg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8w-Wx%2BO3OToMxt%2BFO%2BJRVjHFS8iGTgeh2gz_bC6s%3Df1vA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAAB1%3D8w-Wx%2BO3OToMxt%2BFO%2BJRVjHFS8iGTgeh2gz_bC6s%3Df1vA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3q4jsraEF1pVEb3GSS2Kw6cyR0KwNsJHgs-cnFPwaRzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to