[Maya-Python] issueing commands to mayapy.exe

2018-02-21 Thread Juan Cristóbal Quesada
Hi,
i would like to run several maya scripts from the command line and i would
like each script to be executed by the same mayapy.exe instance.

the intention is to run this command line from another python script via
subprocess.Popen... so the desired behaviour is to have a single instance
of the mayapy.exe subprocess (as a detached process) and issue different
scripts to this.

More generically... is it possible to run different commands to the same
process? something like:

p1 = subprocess.Popen([interpreter.exe,script1,arg1,arg2])

p2 = subprocess.Popen([interpreter.exe,script2,arg3,arg2])

and have script2 be ran by the same process as script1? (not just another
instance?)

-- 
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/CANOg8wXs1XnqmikNOXoegzLJ%3DJgGp-z1MpRvRP6ZDh24u2FNJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] 'module' object has no attribute

2018-02-21 Thread Jason Huang
Hi all,

I got stuck at the beginning of creating a UI interface and couldn't figure 
out what was missing.

ENV: Maya 2018 update 2, Windows 10.

script name: assetManager.py (saved in Maya 2018 scripts folder)
from Qt import QtWidgets, QtCore, QtGui
import pymel.core as pm 

class ObjectManager(QtWidgets.QDialog):
def __init__(self):

super(ObjectManager, self).__init__()

def showUI():
ui = ObjectManager()
ui.show()
return ui

In Maya script editor: (python panel)
import assetManager
reload(assetManager)

ui = assetManager.showUI()

Maya errors out: 
# Error: AttributeError: file  line 1: 'module' object has no 
attribute 'showUI' # 

I am following a course and the same code demo-ed in the course video works 
fine in teacher's Maya session.

Thanks,
Jason

-- 
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/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: issueing commands to mayapy.exe

2018-02-21 Thread Juan Cristóbal Quesada
guess what im asking is if there you can specify the process id for example
to the Popen method and have it use the process if it already exists or
create one if it doesnt

2018-02-21 14:53 GMT+01:00 Juan Cristóbal Quesada <
juan.cristobal...@gmail.com>:

> Hi,
> i would like to run several maya scripts from the command line and i would
> like each script to be executed by the same mayapy.exe instance.
>
> the intention is to run this command line from another python script via
> subprocess.Popen... so the desired behaviour is to have a single instance
> of the mayapy.exe subprocess (as a detached process) and issue different
> scripts to this.
>
> More generically... is it possible to run different commands to the same
> process? something like:
>
> p1 = subprocess.Popen([interpreter.exe,script1,arg1,arg2])
>
> p2 = subprocess.Popen([interpreter.exe,script2,arg3,arg2])
>
> and have script2 be ran by the same process as script1? (not just another
> instance?)
>
>
>

-- 
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/CANOg8wWS8YJ0VwY%2BjQPVhdhGGwKREssmHWJqRt9X5KrjPg5aqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] issueing commands to mayapy.exe

2018-02-21 Thread Marcus Ottosson
Yes, when you import my_script, it is effectively “run”. So what you can do
is launch 1 instance of mayapy, and pass it a single script that imports
the others.

$ mayapy my_script.py

*my_script.py*

import other_script1import other_script2

guess what im asking is if there you can specify the process id for example
to the Popen method and have it use the process if it already exists or
create one if it doesnt

This probably isn’t what you’re looking for. Yes, you can get the process
ID from a Popen instance, but unless you devise an interprocess
communication server/client between your processes, you haven’t got that
many options left for telling the mayapy you find to run another script.

-- 
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/CAFRtmOCFwBwRq-rzjgu9hbg8G7BDWkXLNR5VGTAN55SzMjbX3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Jason Huang
Hey Zeth, 

Sorry for the late response. Much appreciated for the attached script. It 
seems to be super handy tool. I am able to download the attachment just 
fine. Will definitely give that a go and let you know.

cheers,
Jason

On Wednesday, February 21, 2018 at 12:43:07 PM UTC-8, zeth willie wrote:
>
> Hey Jason-
>
> I've attached a script that I wrote a while back that may be useful for 
> stuff like this. Put it in your scripts folder (instructions for executing 
> in the header) and it will help manage your python paths (add, remove, 
> reorder). The first tab lets you save/load paths for quickly loading common 
> paths you use, the second tabs show the item in your python path in order 
> and lets you change a few things. Nothing too fancy, but might be helpful 
> for seeing what's going on.
> I assume dropping a file here isn't an issue. I'm sure I have it handy 
> online (somewhere other than in a big repo on github) if this doesn't work
>
> Zeth
>

-- 
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/345fe13d-8532-47dd-b5b0-f76a08a470d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] writing compound attributes

2018-02-21 Thread fruityfrank
hi ! 

I'm writing a node with compound attributes, and, as always, I'm struggling 
with syntax ! 
I want my attributes to have this hierarchy : 
element
|__element[0]
|__ element[0].position
|__element[0].positionX
|__element[0].positionY
|__element[0].positionZ
|__ element[0].rotation
|__ ...
|_ element[1]
|__ etc...

(Position is an MFnNumericAttribute.createPoint() and orientation is an array, 
and my attributes are outputs)

So the declaration is done correctly, but when I need to write them with the 
databuilder, it's getting a bit more tricky :

hElement = data.outputArrayValue(Node.aElement)
bElement = hElement.builder()
and finally
for i in xrange(num_elements):
bElement.addElement(i).setFloatVector(0, 1, 0)

Obviously, I'm doing something wrong, because my node always returns 0,0,0.
I think I'm actually pointing to the parent, but don't know how to access to 
the child, from there.
Any idea ?

Thanks

(I'm using the python api2.0 for this one)

-- 
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/af89ea57-5b3a-42b0-ba55-6a65001627dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Marcus Ottosson
Try print(assetManager) to find out where the file actually resides on
disk, and make sure it’s the file you expect.
​

On 21 February 2018 at 15:10, Jason Huang  wrote:

> Hi all,
>
> I got stuck at the beginning of creating a UI interface and couldn't
> figure out what was missing.
>
> ENV: Maya 2018 update 2, Windows 10.
>
> script name: assetManager.py (saved in Maya 2018 scripts folder)
> from Qt import QtWidgets, QtCore, QtGui
> import pymel.core as pm
>
> class ObjectManager(QtWidgets.QDialog):
> def __init__(self):
>
> super(ObjectManager, self).__init__()
>
> def showUI():
> ui = ObjectManager()
> ui.show()
> return ui
>
> In Maya script editor: (python panel)
> import assetManager
> reload(assetManager)
>
> ui = assetManager.showUI()
>
> Maya errors out:
> # Error: AttributeError: file  line 1: 'module' object has
> no attribute 'showUI' #
>
> I am following a course and the same code demo-ed in the course video
> works fine in teacher's Maya session.
>
> Thanks,
> Jason
>
> --
> 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/c31b5c6f-15d1-4203-ae10-
> 6eb59dfa2362%40googlegroups.com
> 
> .
> 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/CAFRtmODfGzuZs25T8%3DTiJg6CWTMfnA-X0-BTh0nOmUvxNHujYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Jason Huang
Thanks Marcus. Just tried that and apparently it's executing from the Maya 
2017 scripts folder
print(assetManager)


If I remove the assetManager.py from Maya 2017 scripts folder, everything 
is fine.
Is there a way to tell Maya 2018 to execute from the 2018 script folder 
instead of the 2017?


On Wednesday, February 21, 2018 at 7:18:40 AM UTC-8, Marcus Ottosson wrote:
>
> Try print(assetManager) to find out where the file actually resides on 
> disk, and make sure it’s the file you expect.
> ​
>
> On 21 February 2018 at 15:10, Jason Huang  > wrote:
>
>> Hi all,
>>
>> I got stuck at the beginning of creating a UI interface and couldn't 
>> figure out what was missing.
>>
>> ENV: Maya 2018 update 2, Windows 10.
>>
>> script name: assetManager.py (saved in Maya 2018 scripts folder)
>> from Qt import QtWidgets, QtCore, QtGui
>> import pymel.core as pm 
>>
>> class ObjectManager(QtWidgets.QDialog):
>> def __init__(self):
>>
>> super(ObjectManager, self).__init__()
>>
>> def showUI():
>> ui = ObjectManager()
>> ui.show()
>> return ui
>>
>> In Maya script editor: (python panel)
>> import assetManager
>> reload(assetManager)
>>
>> ui = assetManager.showUI()
>>
>> Maya errors out: 
>> # Error: AttributeError: file  line 1: 'module' object has 
>> no attribute 'showUI' # 
>>
>> I am following a course and the same code demo-ed in the course video 
>> works fine in teacher's Maya session.
>>
>> Thanks,
>> Jason
>>
>> -- 
>> 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/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com
>>  
>> 
>> .
>> 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/b0645cb5-11a4-439a-8dac-891675411e17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Marcus Ottosson
Yes, try something like this.

import sys
sys.path.insert(0,
r"C:\Users\jason\Documents\maya\2018\scripts")import assetManager

sys.path is a list of all directories Python will look for modules, prior
to importing it for the first time. It’s a somewhat forceful way of
achieving it however, it’s likely something is not right with your setup.

Have a look at what your PYTHONPATH looks like.

import os
print(os.getenv("PYTHONPATH"))

PYTHONPATH (may) contain paths that is eventually parsed into sys.path.

If it contains anything, then that is where Python will look for your
modules. Next is having a look at your maya.env file of your user
directory, that can safely be empty. If neither of those have any content,
then something more murky is happening. Maya should be able to find scripts
from its own scripts directory without any interference. If all else fails,
remove/move your Documents\maya directory elsewhere, such that Maya can
create a new one without any customisations.
​

On 21 February 2018 at 15:56, Jason Huang  wrote:

> Thanks Marcus. Just tried that and apparently it's executing from the Maya
> 2017 scripts folder
> print(assetManager)
>  assetManager.pyc'>
>
> If I remove the assetManager.py from Maya 2017 scripts folder, everything
> is fine.
> Is there a way to tell Maya 2018 to execute from the 2018 script folder
> instead of the 2017?
>
>
> On Wednesday, February 21, 2018 at 7:18:40 AM UTC-8, Marcus Ottosson wrote:
>>
>> Try print(assetManager) to find out where the file actually resides on
>> disk, and make sure it’s the file you expect.
>> ​
>>
>> On 21 February 2018 at 15:10, Jason Huang  wrote:
>>
>>> Hi all,
>>>
>>> I got stuck at the beginning of creating a UI interface and couldn't
>>> figure out what was missing.
>>>
>>> ENV: Maya 2018 update 2, Windows 10.
>>>
>>> script name: assetManager.py (saved in Maya 2018 scripts folder)
>>> from Qt import QtWidgets, QtCore, QtGui
>>> import pymel.core as pm
>>>
>>> class ObjectManager(QtWidgets.QDialog):
>>> def __init__(self):
>>>
>>> super(ObjectManager, self).__init__()
>>>
>>> def showUI():
>>> ui = ObjectManager()
>>> ui.show()
>>> return ui
>>>
>>> In Maya script editor: (python panel)
>>> import assetManager
>>> reload(assetManager)
>>>
>>> ui = assetManager.showUI()
>>>
>>> Maya errors out:
>>> # Error: AttributeError: file  line 1: 'module' object has
>>> no attribute 'showUI' #
>>>
>>> I am following a course and the same code demo-ed in the course video
>>> works fine in teacher's Maya session.
>>>
>>> Thanks,
>>> Jason
>>>
>>> --
>>> 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/ms
>>> gid/python_inside_maya/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%
>>> 40googlegroups.com
>>> 
>>> .
>>> 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/b0645cb5-11a4-439a-8dac-
> 891675411e17%40googlegroups.com
> 
> .
>
> 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/CAFRtmOAFOAt4T9F15qjE7u-3miFWpA0hTBGwQjkAhQ5R2fr-Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Jason Huang
Thank you for the tips Marcus. As checking the PYTHONPATH, I guess the 
problem was I have an older version of assetManager.py saved in the 2017 
scripts folder and that directory is part of the PYTHONPATH directories 
Maya will look for modules. Maya 2018 might parse the 2017 scripts 
directory and execute the older version of assetManager.py first.

cheers,
Jason

On Wednesday, February 21, 2018 at 8:08:44 AM UTC-8, Marcus Ottosson wrote:
>
> Yes, try something like this.
>
> import sys
> sys.path.insert(0, r"C:\Users\jason\Documents\maya\2018\scripts")import 
> assetManager
>
> sys.path is a list of all directories Python will look for modules, prior 
> to importing it for the first time. It’s a somewhat forceful way of 
> achieving it however, it’s likely something is not right with your setup.
>
> Have a look at what your PYTHONPATH looks like.
>
> import os
> print(os.getenv("PYTHONPATH"))
>
> PYTHONPATH (may) contain paths that is eventually parsed into sys.path.
>
> If it contains anything, then that is where Python will look for your 
> modules. Next is having a look at your maya.env file of your user 
> directory, that can safely be empty. If neither of those have any content, 
> then something more murky is happening. Maya should be able to find scripts 
> from its own scripts directory without any interference. If all else fails, 
> remove/move your Documents\maya directory elsewhere, such that Maya can 
> create a new one without any customisations.
> ​
>
> On 21 February 2018 at 15:56, Jason Huang  > wrote:
>
>> Thanks Marcus. Just tried that and apparently it's executing from the 
>> Maya 2017 scripts folder
>> print(assetManager)
>> > 'C:\Users\jason\Documents\maya\2017\scripts\assetManager.pyc'>
>>
>> If I remove the assetManager.py from Maya 2017 scripts folder, everything 
>> is fine.
>> Is there a way to tell Maya 2018 to execute from the 2018 script folder 
>> instead of the 2017?
>>
>>
>> On Wednesday, February 21, 2018 at 7:18:40 AM UTC-8, Marcus Ottosson 
>> wrote:
>>>
>>> Try print(assetManager) to find out where the file actually resides on 
>>> disk, and make sure it’s the file you expect.
>>> ​
>>>
>>> On 21 February 2018 at 15:10, Jason Huang  wrote:
>>>
 Hi all,

 I got stuck at the beginning of creating a UI interface and couldn't 
 figure out what was missing.

 ENV: Maya 2018 update 2, Windows 10.

 script name: assetManager.py (saved in Maya 2018 scripts folder)
 from Qt import QtWidgets, QtCore, QtGui
 import pymel.core as pm 

 class ObjectManager(QtWidgets.QDialog):
 def __init__(self):

 super(ObjectManager, self).__init__()

 def showUI():
 ui = ObjectManager()
 ui.show()
 return ui

 In Maya script editor: (python panel)
 import assetManager
 reload(assetManager)

 ui = assetManager.showUI()

 Maya errors out: 
 # Error: AttributeError: file  line 1: 'module' object 
 has no attribute 'showUI' # 

 I am following a course and the same code demo-ed in the course video 
 works fine in teacher's Maya session.

 Thanks,
 Jason

 -- 
 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/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com
  
 
 .
 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/b0645cb5-11a4-439a-8dac-891675411e17%40googlegroups.com
>>  
>> 
>> .
>>
>> 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/09e6f9c7-67fe-406c-902f-8891b23cfe39%40googlegroups.com.
For more 

Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Marcus Ottosson
Ah, well you can spot the order in which directories are evaluated by
looking at the order of paths in sys.path. You should find that the 2017
folder is before the 2018 folder. This shouldn’t be Maya’s doing, but
rather something happening elsewhere. 2018 shouldn’t know about 2017, nor
any other version before it.

Ps. I use the word “should” rather than “is” because sometimes Maya simply
goes bananas. :)
​

On 21 February 2018 at 17:03, Jason Huang  wrote:

> Thank you for the tips Marcus. As checking the PYTHONPATH, I guess the
> problem was I have an older version of assetManager.py saved in the 2017
> scripts folder and that directory is part of the PYTHONPATH directories
> Maya will look for modules. Maya 2018 might parse the 2017 scripts
> directory and execute the older version of assetManager.py first.
>
> cheers,
> Jason
>
> On Wednesday, February 21, 2018 at 8:08:44 AM UTC-8, Marcus Ottosson wrote:
>>
>> Yes, try something like this.
>>
>> import sys
>> sys.path.insert(0, r"C:\Users\jason\Documents\maya\2018\scripts")import 
>> assetManager
>>
>> sys.path is a list of all directories Python will look for modules,
>> prior to importing it for the first time. It’s a somewhat forceful way of
>> achieving it however, it’s likely something is not right with your setup.
>>
>> Have a look at what your PYTHONPATH looks like.
>>
>> import os
>> print(os.getenv("PYTHONPATH"))
>>
>> PYTHONPATH (may) contain paths that is eventually parsed into sys.path.
>>
>> If it contains anything, then that is where Python will look for your
>> modules. Next is having a look at your maya.env file of your user
>> directory, that can safely be empty. If neither of those have any content,
>> then something more murky is happening. Maya should be able to find scripts
>> from its own scripts directory without any interference. If all else fails,
>> remove/move your Documents\maya directory elsewhere, such that Maya can
>> create a new one without any customisations.
>> ​
>>
>> On 21 February 2018 at 15:56, Jason Huang  wrote:
>>
>>> Thanks Marcus. Just tried that and apparently it's executing from the
>>> Maya 2017 scripts folder
>>> print(assetManager)
>>> >> \2017\scripts\assetManager.pyc'>
>>>
>>> If I remove the assetManager.py from Maya 2017 scripts folder,
>>> everything is fine.
>>> Is there a way to tell Maya 2018 to execute from the 2018 script folder
>>> instead of the 2017?
>>>
>>>
>>> On Wednesday, February 21, 2018 at 7:18:40 AM UTC-8, Marcus Ottosson
>>> wrote:

 Try print(assetManager) to find out where the file actually resides on
 disk, and make sure it’s the file you expect.
 ​

 On 21 February 2018 at 15:10, Jason Huang  wrote:

> Hi all,
>
> I got stuck at the beginning of creating a UI interface and couldn't
> figure out what was missing.
>
> ENV: Maya 2018 update 2, Windows 10.
>
> script name: assetManager.py (saved in Maya 2018 scripts folder)
> from Qt import QtWidgets, QtCore, QtGui
> import pymel.core as pm
>
> class ObjectManager(QtWidgets.QDialog):
> def __init__(self):
>
> super(ObjectManager, self).__init__()
>
> def showUI():
> ui = ObjectManager()
> ui.show()
> return ui
>
> In Maya script editor: (python panel)
> import assetManager
> reload(assetManager)
>
> ui = assetManager.showUI()
>
> Maya errors out:
> # Error: AttributeError: file  line 1: 'module' object
> has no attribute 'showUI' #
>
> I am following a course and the same code demo-ed in the course video
> works fine in teacher's Maya session.
>
> Thanks,
> Jason
>
> --
> 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/c31b5c6
> f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com
> 
> .
> 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/ms
>>> gid/python_inside_maya/b0645cb5-11a4-439a-8dac-891675411e17%
>>> 40googlegroups.com
>>> 

Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread Jason Huang
ha...you are right. The 2017 scripts directory indeed shows up in front of 
the 2018 one based on the order listed. Seems like my Maya 2018 is going a 
bit bananas... :) 
Now I know what's going on and a solution. Thank you, Marcus!

On Wednesday, February 21, 2018 at 9:12:19 AM UTC-8, Marcus Ottosson wrote:
>
> Ah, well you can spot the order in which directories are evaluated by 
> looking at the order of paths in sys.path. You should find that the 2017 
> folder is before the 2018 folder. This shouldn’t be Maya’s doing, but 
> rather something happening elsewhere. 2018 shouldn’t know about 2017, nor 
> any other version before it.
>
> Ps. I use the word “should” rather than “is” because sometimes Maya simply 
> goes bananas. :)
> ​
>
> On 21 February 2018 at 17:03, Jason Huang  > wrote:
>
>> Thank you for the tips Marcus. As checking the PYTHONPATH, I guess the 
>> problem was I have an older version of assetManager.py saved in the 2017 
>> scripts folder and that directory is part of the PYTHONPATH directories 
>> Maya will look for modules. Maya 2018 might parse the 2017 scripts 
>> directory and execute the older version of assetManager.py first.
>>
>> cheers,
>> Jason
>>
>> On Wednesday, February 21, 2018 at 8:08:44 AM UTC-8, Marcus Ottosson 
>> wrote:
>>>
>>> Yes, try something like this.
>>>
>>> import sys
>>> sys.path.insert(0, r"C:\Users\jason\Documents\maya\2018\scripts")import 
>>> assetManager
>>>
>>> sys.path is a list of all directories Python will look for modules, 
>>> prior to importing it for the first time. It’s a somewhat forceful way of 
>>> achieving it however, it’s likely something is not right with your setup.
>>>
>>> Have a look at what your PYTHONPATH looks like.
>>>
>>> import os
>>> print(os.getenv("PYTHONPATH"))
>>>
>>> PYTHONPATH (may) contain paths that is eventually parsed into sys.path.
>>>
>>> If it contains anything, then that is where Python will look for your 
>>> modules. Next is having a look at your maya.env file of your user 
>>> directory, that can safely be empty. If neither of those have any content, 
>>> then something more murky is happening. Maya should be able to find scripts 
>>> from its own scripts directory without any interference. If all else fails, 
>>> remove/move your Documents\maya directory elsewhere, such that Maya can 
>>> create a new one without any customisations.
>>> ​
>>>
>>> On 21 February 2018 at 15:56, Jason Huang  wrote:
>>>
 Thanks Marcus. Just tried that and apparently it's executing from the 
 Maya 2017 scripts folder
 print(assetManager)
 >>> 'C:\Users\jason\Documents\maya\2017\scripts\assetManager.pyc'>

 If I remove the assetManager.py from Maya 2017 scripts folder, 
 everything is fine.
 Is there a way to tell Maya 2018 to execute from the 2018 script folder 
 instead of the 2017?


 On Wednesday, February 21, 2018 at 7:18:40 AM UTC-8, Marcus Ottosson 
 wrote:
>
> Try print(assetManager) to find out where the file actually resides 
> on disk, and make sure it’s the file you expect.
> ​
>
> On 21 February 2018 at 15:10, Jason Huang  
> wrote:
>
>> Hi all,
>>
>> I got stuck at the beginning of creating a UI interface and couldn't 
>> figure out what was missing.
>>
>> ENV: Maya 2018 update 2, Windows 10.
>>
>> script name: assetManager.py (saved in Maya 2018 scripts folder)
>> from Qt import QtWidgets, QtCore, QtGui
>> import pymel.core as pm 
>>
>> class ObjectManager(QtWidgets.QDialog):
>> def __init__(self):
>>
>> super(ObjectManager, self).__init__()
>>
>> def showUI():
>> ui = ObjectManager()
>> ui.show()
>> return ui
>>
>> In Maya script editor: (python panel)
>> import assetManager
>> reload(assetManager)
>>
>> ui = assetManager.showUI()
>>
>> Maya errors out: 
>> # Error: AttributeError: file  line 1: 'module' object 
>> has no attribute 'showUI' # 
>>
>> I am following a course and the same code demo-ed in the course video 
>> works fine in teacher's Maya session.
>>
>> Thanks,
>> Jason
>>
>> -- 
>> 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/c31b5c6f-15d1-4203-ae10-6eb59dfa2362%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
 You 

Re: [Maya-Python] seqls/seqinfo (gofileseq) binary releases

2018-02-21 Thread Paul Molodowitch
On Tue, Feb 20, 2018 at 10:44 AM Justin Israel 
wrote:

>
> I'm not really familiar with existing other projects that provide this.
> It's always been just a thing you have to rewrite at the next studio.
>

Only other one I'm aware of is one by mikros:

https://github.com/mikrosimage/sequenceparser

No idea how about it's features, etc... by the time I learned about it, we
already had an established library we were using internally.  Good to get
more alternatives out there for people starting up new pipelines (or
perhaps looking to swap out their solution for something else), though!

 - Paul

-- 
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/CAAssL7bDTYbkfEnVhVCVb8yPOPqgiXBKXT1GyZEuBe0hG6n2tQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] mayapy interpreter error with Anaconda

2018-02-21 Thread Mike Bourbeau



I'm having an issue with PyCharm and autocomplete. The stubs work for 
autocompletion, but my code won't execute. I've added the stubs to the 
PYTHONPATH in my Anaconda environment as you can see in the picture. It 
looks like these stubs are causing Qt.py to break, because when I remove 
the Maya stubs everything works.

Here's my testing 
script: 
https://gist.github.com/mikebourbeauart/8689e511ce7f5fa1f75db5f39890d058 
it just needs PySide Qt.py and python 2.7

>
>

-- 
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/dd971a6f-807b-49d3-a3c1-1b2aac4b83ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] seqls/seqinfo (gofileseq) binary releases

2018-02-21 Thread Justin Israel
On Thu, Feb 22, 2018 at 9:33 AM Marcus Ottosson 
wrote:

> I've mostly used clique  myself, but
> have also glanced at pyseq , fileseq
>  and filesequence
> .​
>

Sweet. A lot of options out there with different available formats!
Maybe people already married to a particular library will still find the
seqls CLI tool helpful if their lib doesn't come with one. It does
concurrent recursive listings of file sequences in one or more root
directories.


> --
> 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/CAFRtmOCxw7XK%2BZWPhEHZK4d45xfY14cukVPbe46OAGRdmqcjkw%40mail.gmail.com
> 
> .
> 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/CAPGFgA2XL7inn14ujDhX9eoCu%3DmBVoECbHfW_eG3V2EZ65o_cg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] seqls/seqinfo (gofileseq) binary releases

2018-02-21 Thread Marcus Ottosson
I've mostly used clique  myself, but
have also glanced at pyseq , fileseq
 and filesequence
.​

-- 
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/CAFRtmOCxw7XK%2BZWPhEHZK4d45xfY14cukVPbe46OAGRdmqcjkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] seqls/seqinfo (gofileseq) binary releases

2018-02-21 Thread Justin Israel
On Thu, Feb 22, 2018, 6:46 AM Paul Molodowitch  wrote:

> On Tue, Feb 20, 2018 at 10:44 AM Justin Israel 
> wrote:
>
>>
>> I'm not really familiar with existing other projects that provide this.
>> It's always been just a thing you have to rewrite at the next studio.
>>
>
> Only other one I'm aware of is one by mikros:
>
> https://github.com/mikrosimage/sequenceparser
>
> No idea how about it's features, etc... by the time I learned about it, we
> already had an established library we were using internally.  Good to get
> more alternatives out there for people starting up new pipelines (or
> perhaps looking to swap out their solution for something else), though!
>

Thanks for that! Took a look to see what it does. It has a few minor
overlapping concepts with fileseq, but not too much. They seem to focus on
slightly different features. SequenceParser looks like it wants to deal
with telling you what is under a given directory, and the number of
consecutive frames ranges each sequence has, and stats info.
Fileseq tends to focus on expressing more complex frame range patterns,
since it is common for renders to say render on 10s, "1-100x10" . Or to
later submit a range that back fills those on-10s renders, "1-100y10". Or
even to submit a range that prioritises 10s first and then the rest,
"1-100:10".
Also, the formats map to Nuke and Katana concepts with # and @ padding,
stepping, and non contiguous ranges, "1-10,15,21,33,50-100x2".

But you are totally right. It's out there so that a new pipeline doesn't
have to yet again write this same code.


>  - Paul
>
> --
> 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/CAAssL7bDTYbkfEnVhVCVb8yPOPqgiXBKXT1GyZEuBe0hG6n2tQ%40mail.gmail.com
> 
> .
> 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/CAPGFgA0a%3DF3jEx5VfvGzzzXFV47a_dzLUUGCuk2C3xOs5gcEpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] 'module' object has no attribute

2018-02-21 Thread zeth willie
Hey Jason-

I've attached a script that I wrote a while back that may be useful for 
stuff like this. Put it in your scripts folder (instructions for executing 
in the header) and it will help manage your python paths (add, remove, 
reorder). The first tab lets you save/load paths for quickly loading common 
paths you use, the second tabs show the item in your python path in order 
and lets you change a few things. Nothing too fancy, but might be helpful 
for seeing what's going on.
I assume dropping a file here isn't an issue. I'm sure I have it handy 
online (somewhere other than in a big repo on github) if this doesn't work

Zeth

-- 
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/d8f71a56-2a0a-405c-bd0e-0d127804077f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

#file: zbw_appendPath.py
#Author: zeth willie
#Contact: zethwil...@gmail.com, www.williework.blogspot.com
#Date Modified: 04/27/13
#To Use: type in python window  "import zbw_appendPath as zap; zap.appendPath()"
#Notes/Descriptions: use to add paths to the python path attribute, which allows you to import scripts from additional locations on your computer/network


import sys, os
import maya.cmds as cmds
import maya.mel as mel
from functools import partial

widgets = {}

def appendUI():
"""UI for appendPath script"""

#create window with 3 text fields, buttons call up proc to add path
if cmds.window("appendPath", exists=True):
cmds.deleteUI("appendPath")

widgets["win"] = cmds.window("appendPath", t="zbw_appendPath", w=500, h=5, s=False, rtf=True)

#create some menus for saving and loading
cmds.setParent(widgets["win"])
widgets["menu"] = cmds.menuBarLayout()
widgets["menuFile"] = cmds.menu(label="file")
cmds.menuItem(l='Clear Values', c=clearValues)
cmds.menuItem(l="Save Add Paths", c=saveValues)
cmds.menuItem(l="Load Add Paths", c=loadValues)

widgets["tabLO"] = cmds.tabLayout(h=210)
widgets["columnLO"] = cmds.columnLayout("Add Paths", w=500)
widgets["path1"] = cmds.textFieldButtonGrp(l="path1", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 1))
widgets["path2"] = cmds.textFieldButtonGrp(l="path2", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 2))
widgets["path3"] = cmds.textFieldButtonGrp(l="path3", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 3))
widgets["melCBG"] = cmds.checkBoxGrp(ncb=1, l1="also add to mel path (MAYA_SCRIPT_PATH)", v1=1, cal=[(1, "left"), (2,
 "left")], cw = [(1, 100), (2,25)])
cmds.separator(h=10, st="single")

widgets["buttonRCL"] = cmds.rowColumnLayout(nc=3, w=500, cw=[(1,123),(2,247 ),(3,123)])
widgets["addCloseBut"] = cmds.button(l="Add and Close", w=120, h=30, bgc=(.6, .8, .6), c=applyClose)
widgets["addBut"] = cmds.button(l="Add Paths!", w=245, h=30, bgc=(.8, .8, .6), c=apply)
widgets["closeBut"] = cmds.button(l="Close", w=120, h=30, bgc=(.8,.6,.6), c=close)

cmds.setParent(widgets["columnLO"])
cmds.separator(h=5, style="single")

cmds.text("Click the '<<<' buttons to browse for paths to add. Click the 'Add' button to add those \npaths to the 'sys.path' list. Use the 'ViewPath' tab to view current list of paths.", al="center")
cmds.text("Use 'file->save' to save the selected paths. Use 'file->load' to load previously saved paths")

#back to window
cmds.setParent(widgets["tabLO"])
widgets["columnLO2"] = cmds.columnLayout("View Paths", w=500)
cmds.text("Double-click to display full path in script editor")
widgets["listTSL"] = cmds.textScrollList(w=500, h=120, fn="smallPlainLabelFont", append=["click button below",
   "to refresh this list!"], dcc=printMe)
refresh()
cmds.separator(h=5, style="single")

widgets["columnLO3"] = cmds.columnLayout(w=500)
widgets["refreshBut"] = cmds.button(l="Refresh Paths", w=500, h=20, bgc=(.5, .5, .6), c=refresh)

cmds.rowColumnLayout(nc=3, cw=[(1,200),(2,150 ),(3,150)])
widgets["removeBut"] = cmds.button(l="Remove Selected", w=180,  h=20, bgc=(.7, .5, .5), c=removePath)
widgets["topBut"] = cmds.button(l="Selected To Top", w=130, h=20, bgc=(.7, .5, .5), c=topPath)
widgets["bottomBut"] = cmds.button(l="Selected To Bottom", w=130, h=20, bgc=(.7, .5, .5), c=bottomPath)

#load (and check) previous saves