compile a scripted plugin as pyc

381 views
Skip to first unread message

sim.On

unread,
Apr 1, 2009, 3:56:38 AM4/1/09
to python_inside_maya
hi ,

i am just curious , how to compile a scripted-plugin as pyc ?

i know , python-pycs can be easily reverse-compiled and i read about
incompatibility-issues , that mkight come along , when using different
versions of python , but i still want to know "HOW TO" create a pyc-
plugin.

thank you for you help and have a nice day
Sim.On

John Creson

unread,
Apr 1, 2009, 10:30:17 AM4/1/09
to python_in...@googlegroups.com
compiling it is not an issue, just load the plugin and Python makes the .pyc in the file next to the plugin.
Getting Maya to load in the .pyc file is another question.

Simon

unread,
Apr 1, 2009, 10:58:23 AM4/1/09
to python_in...@googlegroups.com
hi John ,

thanx for your answer . i already tried to "import" my plugin within the
scripteditor , and maya created the .pyc-file but i remember maya
reported me some errors , that he "cant import" the *.py-file ( i think
, that is because you cannot "import" scripted-plugins)

so , as you described , the pyc did not load proper in the plugin-manager .

on highend3d.com i found one python plugin ( stretchIK ) , that uses pyc
.... but inside the zip from highend , there is next to the pyc also a
__init__.pyc , and i dont know , how to create this __init__pyc in order
to initialize the plugin proper , or if there is a better way , of
compiling scripted-plugins , as i did not find any information on the
net , yet , about - compiling python-plugins .

here is a link to the file i mentioned , that uses a pyc-file
http://highend3d.com/maya/downloads/plugins/animation/Stretchy-ik-4863.html

so maybe anyone can explain , that would be very nice

have a nice day
Sim.On




John Creson schrieb:

John Creson

unread,
Apr 1, 2009, 11:18:43 AM4/1/09
to python_in...@googlegroups.com
It looks like it's using the .py file that just imports everything from the module to encourage maya to properly load the plugin.

So, the one line Plugin file is needed so you can loadPlugin on it, which sets maya up properly to register the plugin.  Thus navigating around the need to loadPlugin on a .py file while wanting to distribute .pyc files.

If you're unsure of what to put into the __init__.pyc file, don't worry too much, try with an empty file, or check out pymel's for some hints on what is possible.  The init file allows Python to recoginse the containing folder as a module (almost like looking at all the files within it's folder as being part of one big text file broken up into understandable parts.)

Simon

unread,
Apr 1, 2009, 11:24:54 AM4/1/09
to python_in...@googlegroups.com
hi John ,

i am just about leaving the door and will try to follow your message
tomorrow , when i find the time .

thanx for your help , i will see tomorrow , if i can get my plugin to
run as pyc

:) sim.On

John Creson schrieb:
> It looks like it's using the .py file that just imports everything
> from the module to encourage maya to properly load the plugin.
>
> So, the one line Plugin file is needed so you can loadPlugin on it,
> which sets maya up properly to register the plugin. Thus navigating
> around the need to loadPlugin on a .py file while wanting to
> distribute .pyc files.
>
> If you're unsure of what to put into the __init__.pyc file, don't
> worry too much, try with an empty file, or check out pymel's for some
> hints on what is possible. The init file allows Python to recoginse
> the containing folder as a module (almost like looking at all the
> files within it's folder as being part of one big text file broken up
> into understandable parts.)
>
> On Wed, Apr 1, 2009 at 10:58 AM, Simon <sim.mn...@googlemail.com
> <mailto:sim.mn...@googlemail.com>> wrote:
>
>
> hi John ,
>
> thanx for your answer . i already tried to "import" my plugin
> within the
> scripteditor , and maya created the .pyc-file but i remember maya
> reported me some errors , that he "cant import" the *.py-file ( i
> think
> , that is because you cannot "import" scripted-plugins)
>
> so , as you described , the pyc did not load proper in the
> plugin-manager .
>
> on highend3d.com <http://highend3d.com> i found one python plugin
> ( stretchIK ) , that uses pyc
> .... but inside the zip from highend , there is next to the pyc also a
> __init__.pyc , and i dont know , how to create this __init__pyc in
> order
> to initialize the plugin proper , or if there is a better way , of
> compiling scripted-plugins , as i did not find any information on the
> net , yet , about - compiling python-plugins .
>
> here is a link to the file i mentioned , that uses a pyc-file
> http://highend3d.com/maya/downloads/plugins/animation/Stretchy-ik-4863.html
>
> so maybe anyone can explain , that would be very nice
>
> have a nice day
> Sim.On
>
>
>
>
> John Creson schrieb:
> > compiling it is not an issue, just load the plugin and Python makes
> > the .pyc in the file next to the plugin.
> > Getting Maya to load in the .pyc file is another question.
> >
> > On Wed, Apr 1, 2009 at 3:56 AM, sim.On
> <sim.mn...@googlemail.com <mailto:sim.mn...@googlemail.com>
> > <mailto:sim.mn...@googlemail.com
Reply all
Reply to author
Forward
0 new messages