this seems to work well enough for my needs:
in MayaSublime.py
PY_CMD_TEMPLATE = "import traceback\nimport
__main__\ntry:\n\texec('''%s''', __main__.__dict__,
__main__.__dict__)\nexcept:\n\ttraceback.print_exc()"
On Friday, September 21, 2012 1:33:35 AM UTC+8, Justin Israel wrote:
>
> The commandPort would need to return something. This would probably be
> what you want:
> cmds.commandPort(name=":7002", sourceType="python")
>
> But the real problem has to do with the way the command is wrapped in
> the exec statement before it is sent to Maya. I do that so the code
> that is sent is executed in the main scope.The negative is not easily
> being able to retrieve results. You would always get None.
>
> I've been playing around with it for a bit, trying to replace
> stdout/stderr before calling exec, but haven't come up with anything
> 100% solid yet. I can get traceback messages so far.
>
>
> On Thu, Sep 20, 2012 at 3:01 AM, Danny Wynne <[email protected]<javascript:>>
> wrote:
> > thanks for this, how can I get maya to print errors from the code that
> your
> > scripts sends it? Or do I need to write something to listen for a
> response
> > in sublime?
> > im opening the port with cmds.commandPort(name=":7002",
> sourceType="python",
> > eo=True, nr=True)
> > echoOutput(eo) and noreturn(nr)arguments don't seem to do the trick
> > thanks,
> >
> >
> > On Monday, August 27, 2012 12:23:17 PM UTC+8, Justin Israel wrote:
> >>
> >> I made a quick plugin a little bit ago for sending code to maya:
> >> https://github.com/justinfx/MayaSublime
> >>
> >> I had also come across a neat little module for doing a hook between
> pdb
> >> and sublime: http://pypi.python.org/pypi/PdbSublimeTextSupport
> >>
> >>
> >>
> >>
> >>
> >> On Aug 26, 2012, at 7:24 PM, "melvin.3d" <[email protected]> wrote:
> >>
> >> Hey Justin,
> >> Yes auto completion for cmds and api , sending code from sublime to
> Maya ,
> >> perhaps debugging ability as well. I am not sure if sublime has any
> sort of
> >> breakpoint system. Let me try adding the pymel stubs you suggested
> first.
> >> Thanks.
> >>
> >>
> >> On Sun, Aug 26, 2012 at 7:18 PM, Justin Israel <[email protected]>
> >> wrote:
> >>>
> >>> You mean like completion for the cmds and api?
> >>>
> >>> You can just add the pymel stubs location for the cmds and api modules
> to
> >>> your PYTHONPATH in your python settings in Sublime. They live in your
> Maya
> >>> install location under a py dir (It is different per operating system)
> >>>
> >>>
> >>>
> >>> On Aug 26, 2012, at 5:37 PM, Melvin3D <[email protected]> wrote:
> >>>
> >>> Hi Guys,
> >>> Is there any written workflow out there about how to set up Sublime
> with
> >>> recent versions of Maya 2012 , 2013 ?
> >>> Much appreciated!
> >>>
> >>> Thanks.
> >>>
> >>> Melvin3d
> >>>
> >>> --
> >>> view archives: http://groups.google.com/group/python_inside_maya
> >>> change your subscription settings:
> >>> http://groups.google.com/group/python_inside_maya/subscribe
> >>>
> >>> --
> >>> view archives: http://groups.google.com/group/python_inside_maya
> >>> change your subscription settings:
> >>> http://groups.google.com/group/python_inside_maya/subscribe
> >>
> >>
> >> --
> >> view archives: http://groups.google.com/group/python_inside_maya
> >> change your subscription settings:
> >> http://groups.google.com/group/python_inside_maya/subscribe
> >
> > --
> > view archives: http://groups.google.com/group/python_inside_maya
> > change your subscription settings:
> > http://groups.google.com/group/python_inside_maya/subscribe
>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe