On Fri, May 24, 2019 at 6:07 PM Justin Israel <justinisr...@gmail.com> wrote:
> It is much easier if you just stick with forward slashing for your paths, > which will work fine in Windows as far as I know: > > mp = 'c:/Program Files/Autodesk/Maya2016.5/bin/mayapy.exe' > function = > '//discobolos1/websters/install/MAYA_SCRIPTS/PYTHON/batchMaya.py' > > I'm not really sure about the first part of the function. Is that a > network path? Do you get any errors in your console/shell? > I'm still not fully clear if UNC paths can use forward slashes or not, but if you want to try with backslashes, you need to remember to use a raw string, otherwise you would have to double escape the backslashes: mp = r'c:\Program Files\Autodesk\Maya2016.5\bin\mayapy.exe' function = r'\\discobolos1\websters\install\MAYA_SCRIPTS\PYTHON\batchMaya.py' Note the r character in front of the string which means python won't interpret the backslashes. > On Fri, May 24, 2019 at 5:12 PM tomas mikulak <mikulakto...@gmail.com> > wrote: > >> no still nothing. >> >> here is how I try to run it from maya >> >> >> import maya.cmds as mc >> import os >> import subprocess >> import sys >> >> mp = 'c:\Program Files\Autodesk\Maya2016.5\bin\mayapy.exe' >> >> function = >> '\\discobolos1\websters\install\MAYA_SCRIPTS\PYTHON\batchMaya.py' >> >> print(function) >> arg = ' -p ' >> arg2 = '"c:\\"' >> print(arg) >> print(command) >> >> >> subprocess.call([mp,function,arg,arg2]) >> >> >> if I run subprocess.call([mp]) it runs mayapy su I know it is not all >> wrong, but I have tried many \ or \\ variations for paths and it always >> ends with Result:2 in maya and no file is created >> >> >> >> >> pi 24. 5. 2019 o 6:56 tomas mikulak <mikulakto...@gmail.com> napísal(a): >> >>> I used subprocess but it didn’t create a file. and it gave me error >>> wrong path, now I see a light there, I put -p “c:\\” as one argument and >>> you separated it, I will give it a try, thanks >>> >>> On Fri, 24 May 2019 at 00:45, Justin Israel <justinisr...@gmail.com> >>> wrote: >>> >>>> >>>> >>>> On Fri, May 24, 2019 at 10:26 AM tomas mikulak <mikulakto...@gmail.com> >>>> wrote: >>>> >>>>> >>>>> Hi everyone, >>>>> could somebody help me with running script with argument(path) to save >>>>> new file maya standalone will create and save it to given location and all >>>>> that from maya. >>>>> I wrote simple python script that takes path argument and when I do it >>>>> manually openning cmd and typing mayapy path\\script.py -p “c:\\” >>>>> it works and creates simple scene with sphere named test on c drive >>>>> but I can’t figure it out how to run it from maya. >>>>> this is just concept what I need standalone to do. >>>>> >>>> >>>> Are you saying that you are seeing failures when you run it from Maya? >>>> Or that you don't know how to execute it from Maya? If its a matter of how >>>> to even run the script, you would go about that using the 'subprocess' >>>> module: >>>> >>>> import subprocess >>>> exitcode = subprocess.call(["mayapy", "/path/to/script.py", "-p", >>>> "c:\\"]) >>>> >>>> See: >>>> https://docs.python.org/2/library/subprocess.html >>>> >>>> >>>> -- >>>>> 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/CAEUzAD282xN-WZq2nGN%2BUn9fZGyd6ZGNNJ%3DBNdwJEjcWz34C_A%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD282xN-WZq2nGN%2BUn9fZGyd6ZGNNJ%3DBNdwJEjcWz34C_A%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/CAPGFgA3vzvk_f5090kycrbzTqf8XD%2BiYnEgo%2BrZ%2BO_1k_2LZtQ%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3vzvk_f5090kycrbzTqf8XD%2BiYnEgo%2BrZ%2BO_1k_2LZtQ%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/CAEUzAD3aLTgd1N25D%3DZNTF4-hYkF5UDY236_ax%3DvaNrZiQ8Vaw%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD3aLTgd1N25D%3DZNTF4-hYkF5UDY236_ax%3DvaNrZiQ8Vaw%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/CAPGFgA2JaieLnbR27bf4BD4OiJ1AXrJUfmSOn8ivG3iNdarDhA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.