How to execute Maya python scripts in PyCharm












0















I'm writing some simple pipeline scripts for my company.
I did lots of houdini work in pycham and it works as expected:
When you work in houdini python interpreter it is like working in houdini without UI.
BUT, with Maya I cant get anything working inside PyCharm, I have to execute everything in Maya using MayaCharm plug in.
Completition works, imports work, but whatever I do, whatever function, methods, .. I call I'm always getting 'None' as results.
Not errors, just 'None' as result.
I tried solution from: How do I execute Maya script without lauching Maya? but it also don't work.
Result of "my_cube = cmds.polyCube()" is "None".
Even if I just call cmds.ls() I'm getting "None"
Any help or ideas?










share|improve this question



























    0















    I'm writing some simple pipeline scripts for my company.
    I did lots of houdini work in pycham and it works as expected:
    When you work in houdini python interpreter it is like working in houdini without UI.
    BUT, with Maya I cant get anything working inside PyCharm, I have to execute everything in Maya using MayaCharm plug in.
    Completition works, imports work, but whatever I do, whatever function, methods, .. I call I'm always getting 'None' as results.
    Not errors, just 'None' as result.
    I tried solution from: How do I execute Maya script without lauching Maya? but it also don't work.
    Result of "my_cube = cmds.polyCube()" is "None".
    Even if I just call cmds.ls() I'm getting "None"
    Any help or ideas?










    share|improve this question

























      0












      0








      0








      I'm writing some simple pipeline scripts for my company.
      I did lots of houdini work in pycham and it works as expected:
      When you work in houdini python interpreter it is like working in houdini without UI.
      BUT, with Maya I cant get anything working inside PyCharm, I have to execute everything in Maya using MayaCharm plug in.
      Completition works, imports work, but whatever I do, whatever function, methods, .. I call I'm always getting 'None' as results.
      Not errors, just 'None' as result.
      I tried solution from: How do I execute Maya script without lauching Maya? but it also don't work.
      Result of "my_cube = cmds.polyCube()" is "None".
      Even if I just call cmds.ls() I'm getting "None"
      Any help or ideas?










      share|improve this question














      I'm writing some simple pipeline scripts for my company.
      I did lots of houdini work in pycham and it works as expected:
      When you work in houdini python interpreter it is like working in houdini without UI.
      BUT, with Maya I cant get anything working inside PyCharm, I have to execute everything in Maya using MayaCharm plug in.
      Completition works, imports work, but whatever I do, whatever function, methods, .. I call I'm always getting 'None' as results.
      Not errors, just 'None' as result.
      I tried solution from: How do I execute Maya script without lauching Maya? but it also don't work.
      Result of "my_cube = cmds.polyCube()" is "None".
      Even if I just call cmds.ls() I'm getting "None"
      Any help or ideas?







      python pycharm maya houdini






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 17:44









      Tom VujnovicTom Vujnovic

      1




      1
























          2 Answers
          2






          active

          oldest

          votes


















          0














          If you launching your script with mayapy, you might wanna initialize maya first:
          https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/PyMel/standalone.html



          import maya.standalone
          maya.standalone.initialize(name='python')
          import maya.cmds as cmds


          If you trying to launch something from PyCharm right in the live Maya session, then MayaCharm is they way to go I believe.






          share|improve this answer
























          • Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

            – Tom Vujnovic
            Nov 25 '18 at 20:20











          • I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

            – Kthulhu Fhtagn
            Nov 26 '18 at 3:32





















          0














          If you want to execute in Maya but use Pycharm as an editor, you should probably just use MayaCharm, which is designed precisely for that purpose.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460834%2fhow-to-execute-maya-python-scripts-in-pycharm%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            If you launching your script with mayapy, you might wanna initialize maya first:
            https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/PyMel/standalone.html



            import maya.standalone
            maya.standalone.initialize(name='python')
            import maya.cmds as cmds


            If you trying to launch something from PyCharm right in the live Maya session, then MayaCharm is they way to go I believe.






            share|improve this answer
























            • Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

              – Tom Vujnovic
              Nov 25 '18 at 20:20











            • I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

              – Kthulhu Fhtagn
              Nov 26 '18 at 3:32


















            0














            If you launching your script with mayapy, you might wanna initialize maya first:
            https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/PyMel/standalone.html



            import maya.standalone
            maya.standalone.initialize(name='python')
            import maya.cmds as cmds


            If you trying to launch something from PyCharm right in the live Maya session, then MayaCharm is they way to go I believe.






            share|improve this answer
























            • Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

              – Tom Vujnovic
              Nov 25 '18 at 20:20











            • I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

              – Kthulhu Fhtagn
              Nov 26 '18 at 3:32
















            0












            0








            0







            If you launching your script with mayapy, you might wanna initialize maya first:
            https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/PyMel/standalone.html



            import maya.standalone
            maya.standalone.initialize(name='python')
            import maya.cmds as cmds


            If you trying to launch something from PyCharm right in the live Maya session, then MayaCharm is they way to go I believe.






            share|improve this answer













            If you launching your script with mayapy, you might wanna initialize maya first:
            https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/PyMel/standalone.html



            import maya.standalone
            maya.standalone.initialize(name='python')
            import maya.cmds as cmds


            If you trying to launch something from PyCharm right in the live Maya session, then MayaCharm is they way to go I believe.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 25 '18 at 18:14









            Kthulhu FhtagnKthulhu Fhtagn

            3114




            3114













            • Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

              – Tom Vujnovic
              Nov 25 '18 at 20:20











            • I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

              – Kthulhu Fhtagn
              Nov 26 '18 at 3:32





















            • Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

              – Tom Vujnovic
              Nov 25 '18 at 20:20











            • I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

              – Kthulhu Fhtagn
              Nov 26 '18 at 3:32



















            Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

            – Tom Vujnovic
            Nov 25 '18 at 20:20





            Did that. In mayapy maya.cmds, maya.api.<whatever> worked always. problem was that I couldn't import hou. Now I reinstaled everything and (I don't know where from) under interpreter paths there was "C:Program FilesSide Effects SoftwareHoudini 16.5.268houdinipython2.7libs" and import hou works. I probably messed up something with paths. When I have more time I'll try to find out what are exact steps and will post them here. Now I'm a happy camper, having maya and houdini under one interpreter so I can write few maya->houdini scene parsing scripts that I need. :)

            – Tom Vujnovic
            Nov 25 '18 at 20:20













            I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

            – Kthulhu Fhtagn
            Nov 26 '18 at 3:32







            I'm not sure how everyone doing that, but taking into account broken state of Maya out of box completion for Python I decided to go radical way and made a separate 'development' PyCharm environment where all the pymel, cmds, and openmaya specially prepared completion files reside. Very handy. To run my scripts in working environment I'm just using Maya itself or mayapy, or even system Python27 with sys.path set to Maya site-packages.

            – Kthulhu Fhtagn
            Nov 26 '18 at 3:32















            0














            If you want to execute in Maya but use Pycharm as an editor, you should probably just use MayaCharm, which is designed precisely for that purpose.






            share|improve this answer




























              0














              If you want to execute in Maya but use Pycharm as an editor, you should probably just use MayaCharm, which is designed precisely for that purpose.






              share|improve this answer


























                0












                0








                0







                If you want to execute in Maya but use Pycharm as an editor, you should probably just use MayaCharm, which is designed precisely for that purpose.






                share|improve this answer













                If you want to execute in Maya but use Pycharm as an editor, you should probably just use MayaCharm, which is designed precisely for that purpose.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 4:57









                theodoxtheodox

                9,80321634




                9,80321634






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460834%2fhow-to-execute-maya-python-scripts-in-pycharm%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin