ok, I finally made it, I had to use another set of brackets for argument
a=subprocess.Popen([mp ,function, [' -p \"c:\\
\"']],stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
I also found out how to print to maya console when it breaks,

thanks guys, very much appreciated,

tomas

ne 26. 5. 2019 o 1:42 tomas mikulak <mikulakto...@gmail.com> napísal(a):

> I have some progress, I put variable name and path to one arrgument and it
> is tryint to work now, but it starts to complain about path again and I
> don't know why it is trying to save to default scenes
>
>
> so 25. 5. 2019 o 20:47 tomas mikulak <mikulakto...@gmail.com> napísal(a):
>
>> could somebody just run my script with any path to prove me I can’t do
>> simple things, thanks
>>
>> On Fri, 24 May 2019 at 08:54, tomas mikulak <mikulakto...@gmail.com>
>> wrote:
>>
>>> ok,
>>> I changed backslash to forward slash
>>> import maya.cmds as mc
>>> import os
>>> import subprocess
>>> import sys
>>>
>>> mp = 'c://Program Files//Autodesk//Maya2016.5//bin//mayapy.exe'
>>> function = 'c://batchMaya.py'
>>> arg = ' -p '
>>> arg2 = 'c://'
>>>
>>> subprocess.call([mp,function,arg,arg2])
>>>
>>> even version like this
>>>
>>>
>>> import maya.cmds as mc
>>> import os
>>> import subprocess
>>> import sys
>>>
>>> mp = r'c:/Program Files/Autodesk/Maya2016.5/bin/mayapy.exe'
>>> function = r'c:/batchMaya.py'
>>> arg = ' -p '
>>> arg2 = r'c:/'
>>>
>>>
>>>
>>> subprocess.call([mp,function,arg,arg2])
>>>
>>> no file created.
>>>
>>> pi 24. 5. 2019 o 8:45 Marcus Ottosson <konstrukt...@gmail.com>
>>> napísal(a):
>>>
>>>> The path didn’t exist because, as Justin mentioned, Python interpreted
>>>> those backslashes to make “escape characters”.
>>>>
>>>> path = '\\discobolos1\websters\install\MAYA_SCRIPTS\PYTHON\batchMaya.py'
>>>> raw_path = 
>>>> r'\\discobolos1\websters\install\MAYA_SCRIPTS\PYTHON\batchMaya.py'
>>>>
>>>> print("path: %s" % path)
>>>> print("raw_path: %s" % raw_path)
>>>> # path: \discobolos1\websters\install\MAYA_SCRIPTS\PYTHOatchMaya.py# 
>>>> raw_path: \\discobolos1\websters\install\MAYA_SCRIPTS\PYTHON\batchMaya.py
>>>>
>>>> Note the PYTHONOathMaya.py, that’s what Python was looking for because
>>>> \b got converted into O.
>>>>
>>>> On Fri, 24 May 2019 at 07:22, tomas mikulak <mikulakto...@gmail.com>
>>>> wrote:
>>>>
>>>>> no error now, before I got error about path don’t exist. I might just
>>>>> save script on c:/ to see if that was some path problem or what, it is 
>>>>> just
>>>>> frustraiting.
>>>>>
>>>>> On Fri, 24 May 2019 at 08:07, 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?
>>>>>>
>>>>>> 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/CAPGFgA3AqKu8a%3DOX1h%2BwF_rEHfgv-yyM5QP0SuhRzGbjp2AB9Q%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3AqKu8a%3DOX1h%2BwF_rEHfgv-yyM5QP0SuhRzGbjp2AB9Q%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/CAEUzAD28cqZi%2BwrT3eZDygsctNoWUZDmWdN%3DQJ90VrpqRXpHEQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAEUzAD28cqZi%2BwrT3eZDygsctNoWUZDmWdN%3DQJ90VrpqRXpHEQ%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/CAFRtmOA8JKTf2DKf5ynY_MRUjtDzUPqKpAuVf%2Bbk7TF8OMCj9g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA8JKTf2DKf5ynY_MRUjtDzUPqKpAuVf%2Bbk7TF8OMCj9g%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/CAEUzAD1-4Eq7WViQzrRoePRCy0wPCSE7YZGTtRLFPg5vLDaK9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to