Also, this does not solve your problem but is relevant, just so you know, import pymel.core will take care of the initialization in one line, you read more about it here <https://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/standalone.html>. But if you want to be more explicit about it (which I think you should be) then your initialization code is better.
On Tue, May 16, 2017 at 9:44 AM, Justin Israel <[email protected]> wrote: > So if you have a script that does nothing except > "maya.standalone.initialize()" and "import os", you are seeing this import > error? > Are you doing anything to modify the PYTHONPATH? > > Justin > > > On Tue, May 16, 2017 at 12:44 PM likage <[email protected]> wrote: > >> Hi everyone, I am trying to run a terminal command while using >> maya.standalone and run into some problems. >> There is this terminal command in which if I run `someCommand >> my_file.txt`, it works correctly, as I expecting it to be. >> >> When I tried to incorporate it into my script: >> os.system('someCommand /user_data/some_file.txt') >> >> >> I was prompted with the following error when I tried to execute it with >> Mayapy command: >> >> Traceback (most recent call last): >> File "/server/scripts/someCommand", line 6, in <module> >> import os >> ImportError: No module named os >> >> >> Tried using `subprocess` but same error persists. How can I rectify this >> and why is it that `os` module error occurs? >> In my python file, `os` is working for sure.. >> >> >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit https://groups.google.com/d/ >> msgid/python_inside_maya/97fa1bf8-0ada-4f1f-a6c2- >> f1e72b8940c9%40googlegroups.com >> <https://groups.google.com/d/msgid/python_inside_maya/97fa1bf8-0ada-4f1f-a6c2-f1e72b8940c9%40googlegroups.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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/python_inside_maya/CAPGFgA0QBiLWZE9Pc0OWr0mOKTzum > HvkimgR0kXHm%3DJhWHoiOA%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0QBiLWZE9Pc0OWr0mOKTzumHvkimgR0kXHm%3DJhWHoiOA%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMQrGUhJOpSU6fOtGh3gtBLmF%2BbiL3N43z5SdVAk5tDTPw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
