Sphinx issues with OpenMaya?

247 views
Skip to first unread message

Mark Jackson

unread,
Sep 7, 2016, 4:31:38 AM9/7/16
to python_inside_maya
Morning all,

I'm trying to get our API docs updated and to do so I've always run Sphinx to generate the docs but from an old laptop that was 32bit and running Maya2012. 

I'm trying to get the whole thing running again from 2016 but running into issues whenever the Sphinx build process hits OpenMaya.

# #     import maya.OpenMaya as OpenMaya
# #   File "S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 25, in <module>
# #   File "S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 21, in swig_import_helper
# # ImportError: DLL load failed: The specified procedure could not be found.

As far as I can tell all the Eclipse environment is fine, all our unitTests run fine and those all call the same Maya boot sequence which in turn needs OpenMaya for all the MetaData testing. For some reason when Sphinx tries to build the Maya environment it bails with OpenMay.

Can anybody shed any idea as to why Sphinx wouldn't play nicely with OpenMaya as it's driving me mad!

thanks

Mark

Marcus Ottosson

unread,
Sep 7, 2016, 5:20:14 AM9/7/16
to python_in...@googlegroups.com
DLL load failed errors are typically due to your Python version trying to load a module that wasn't compiled for it.

Have a look in your environment for things like PySide/PyQt and that your Python actually running is `mayapy`.

--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FE5R54xNLg_hpoCgRDW-bGW7K%2BjPnp3XwNTX0xWg7FdiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Cesar Saez

unread,
Sep 7, 2016, 5:37:09 AM9/7/16
to python_in...@googlegroups.com

Don't you mock Maya modules during docs generation?
Sphinx most likely doesn't need anything from Maya other than being able to import your modules, I totally recommend to take a look at mock for these kind of things.

Cheers

Mark Jackson

unread,
Sep 7, 2016, 5:37:14 AM9/7/16
to python_inside_maya
Yeah thats what I thought, but I grabbed everything via setuptools and everything is pathed up and using the correct interpreter. Like I mentioned the unitTests are all running so the environment should be fine else they'd bail also, or so I'd have thought. Not sure if it's a mismatch in the build version of Sphinx itself?

What does everybody else run for auto-documentation now as I need to get these api docs generated and have spent way too long trying to get Sphinx breathing again.

cheers Marcus

On 7 September 2016 at 10:20, Marcus Ottosson <konstr...@gmail.com> wrote:
DLL load failed errors are typically due to your Python version trying to load a module that wasn't compiled for it.

Have a look in your environment for things like PySide/PyQt and that your Python actually running is `mayapy`.
On 7 September 2016 at 09:31, Mark Jackson <mar...@gmail.com> wrote:
Morning all,

I'm trying to get our API docs updated and to do so I've always run Sphinx to generate the docs but from an old laptop that was 32bit and running Maya2012. 

I'm trying to get the whole thing running again from 2016 but running into issues whenever the Sphinx build process hits OpenMaya.

# #     import maya.OpenMaya as OpenMaya
# #   File "S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 25, in <module>
# #   File "S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 21, in swig_import_helper
# # ImportError: DLL load failed: The specified procedure could not be found.

As far as I can tell all the Eclipse environment is fine, all our unitTests run fine and those all call the same Maya boot sequence which in turn needs OpenMaya for all the MetaData testing. For some reason when Sphinx tries to build the Maya environment it bails with OpenMay.

Can anybody shed any idea as to why Sphinx wouldn't play nicely with OpenMaya as it's driving me mad!

thanks

Mark

--
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+unsubscribe@googlegroups.com.



--
Marcus Ottosson
konstr...@gmail.com

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-------------------------------------
Mark Jackson
CEO / Technical Director
red9consultancy.com

Marcus Ottosson

unread,
Sep 7, 2016, 5:46:53 AM9/7/16
to python_in...@googlegroups.com
Have a look at trying to narrow it down to something reproducible. For example, delete half the pages of your Sphinx documentation, and see if it still breaks. Keep deleting half of half until you've got the smallest amount of lines that still throw the error.

Then post the whole sequence of commands that led to the problem. That might make it easier to see what's going on.

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Christopher Crouzet

unread,
Sep 7, 2016, 5:52:39 AM9/7/16
to python_in...@googlegroups.com
If it isn't the case already, I'd do as Cesar said—maybe there are better implementations but here's an example of “mocking” the Maya module for Sphinx: https://github.com/christophercrouzet/banana.maya/blob/master/doc/conf.py#L11


On 7 September 2016 at 16:46, Marcus Ottosson <konstr...@gmail.com> wrote:
Have a look at trying to narrow it down to something reproducible. For example, delete half the pages of your Sphinx documentation, and see if it still breaks. Keep deleting half of half until you've got the smallest amount of lines that still throw the error.

Then post the whole sequence of commands that led to the problem. That might make it easier to see what's going on.
On 7 September 2016 at 10:37, Cesar Saez <ces...@gmail.com> wrote:

Don't you mock Maya modules during docs generation?
Sphinx most likely doesn't need anything from Maya other than being able to import your modules, I totally recommend to take a look at mock for these kind of things.

Cheers

--
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+unsubscribe@googlegroups.com.



--
Marcus Ottosson
konstr...@gmail.com

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Marcus Ottosson

unread,
Sep 7, 2016, 5:57:42 AM9/7/16
to python_in...@googlegroups.com
He did say OpenMaya was needed for his MetaData implementation.

But if not, I would also suggest stripping the dependency from your documentation generator. Mocking is one way of doing that.

On 7 September 2016 at 10:52, Christopher Crouzet <christoph...@gmail.com> wrote:
If it isn't the case already, I'd do as Cesar said—maybe there are better implementations but here's an example of “mocking” the Maya module for Sphinx: https://github.com/christophercrouzet/banana.maya/blob/master/doc/conf.py#L11

On 7 September 2016 at 16:46, Marcus Ottosson <konstr...@gmail.com> wrote:
Have a look at trying to narrow it down to something reproducible. For example, delete half the pages of your Sphinx documentation, and see if it still breaks. Keep deleting half of half until you've got the smallest amount of lines that still throw the error.

Then post the whole sequence of commands that led to the problem. That might make it easier to see what's going on.

On 7 September 2016 at 10:37, Cesar Saez <ces...@gmail.com> wrote:

Don't you mock Maya modules during docs generation?
Sphinx most likely doesn't need anything from Maya other than being able to import your modules, I totally recommend to take a look at mock for these kind of things.

Cheers

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPamJi8d6%2B1Ni5LO5EY2Atd-qrkjfzJ6b9TWCpNiuwMFUJyp2g%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

--
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+unsubscribe@googlegroups.com.



--

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Cesar Saez

unread,
Sep 7, 2016, 6:01:31 AM9/7/16
to python_in...@googlegroups.com

No need to reinvent the wheel, there's a std/production proved mock module! (it's part of python3 std Library iirc).

pip install mock

You basically replace Maya entries on sys.modules by a MagicMock instance (check the docs for more info, there are convenience functions to do it and everything... mocking dependencies is a very common practice and is well documented).

Hope this helps,
Cheers

Christopher Crouzet

unread,
Sep 7, 2016, 6:13:08 AM9/7/16
to python_in...@googlegroups.com
Marcus: I have no idea what this MetaData implementation refers to?

Cesar: True but I personally like avoiding unnecessary external dependencies for such simple needs (the module `mock` is not part of `mayapy` which is Python 2). Otherwise it feels like coding in JavaScript using one line NPM modules such as https://github.com/kevva/is-positive :) To each its own.


--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christopher Crouzet

unread,
Sep 7, 2016, 6:22:52 AM9/7/16
to python_in...@googlegroups.com
PS: the mock code isn't mine and I failed to credit the original author in my repository, so here it is for now: http://stackoverflow.com/a/23573376/1640404. I'll add the link in a future commit.


On 7 September 2016 at 17:13, Christopher Crouzet <christoph...@gmail.com> wrote:
Marcus: I have no idea what this MetaData implementation refers to?

Cesar: True but I personally like avoiding unnecessary external dependencies for such simple needs (the module `mock` is not part of `mayapy` which is Python 2). Otherwise it feels like coding in JavaScript using one line NPM modules such as https://github.com/kevva/is-positive :) To each its own.

On 7 September 2016 at 17:01, Cesar Saez <ces...@gmail.com> wrote:

No need to reinvent the wheel, there's a std/production proved mock module! (it's part of python3 std Library iirc).

pip install mock

You basically replace Maya entries on sys.modules by a MagicMock instance (check the docs for more info, there are convenience functions to do it and everything... mocking dependencies is a very common practice and is well documented).

Hope this helps,
Cheers

--
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+unsubscribe@googlegroups.com.
--

Marcus Ottosson

unread,
Sep 7, 2016, 6:25:35 AM9/7/16
to python_in...@googlegroups.com
> Marcus: I have no idea what this MetaData implementation refers to?

Hi Christopher, Mark was referring to this by name in the original question as one of the requirements for his document generation.

For completeness, here it is again.


> all our unitTests run fine and those all call the same Maya boot sequence which in turn needs OpenMaya for all the MetaData testing.

Best,
Marcus


To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANuKW51ean%3DeKNFf-XvQ2zZU1Cf4uUW-g8RPbsCbky50TeGtCg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Christopher Crouzet

unread,
Sep 7, 2016, 6:31:58 AM9/7/16
to python_in...@googlegroups.com
Yes, I did see this but I've got no idea what it refers to. I'd be curious to know what kind of “testing” code would have its place within a doc generation process?





--
Marcus Ottosson
konstr...@gmail.com

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Marcus Ottosson

unread,
Sep 7, 2016, 6:41:58 AM9/7/16
to python_in...@googlegroups.com
I also don't know what his code does precisely, but I wouldn't be so quick to dismiss.

It's possible he has executable documentation; in which code snippets within his documentation are executed at build time to produce actual output, rather than hard-code it. That way he would also become notified when his documentation says one thing, but his code does differently.

Overall, I don't see a problem with Sphinx having access to OpenMaya, or any other Python library.




--

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Mark Jackson

unread,
Sep 7, 2016, 6:46:03 AM9/7/16
to python_inside_maya
Thanks for all the replies guys, currently all our testing / unitTesting all goes through nose and coverage, I keep thinking about moving some of that to doctest side of things but thats all got side-lined for a while. 

Mock sounds like something I should be looking into, but I still can't get my head round why Sphinx can't deal with OpenMaya, unless the Sphinx script itself is 32bit and therefore consuming the 64bit OpenMaya is bailing it? 



On 7 September 2016 at 11:31, Christopher Crouzet <christoph...@gmail.com> wrote:



--

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Marcus Ottosson

unread,
Sep 7, 2016, 7:01:16 AM9/7/16
to python_in...@googlegroups.com
Mark, what does the actual command that you are running look like that produces the error?




--
-------------------------------------
Mark Jackson
CEO / Technical Director
red9consultancy.com

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Mark Jackson

unread,
Sep 7, 2016, 7:23:32 AM9/7/16
to python_inside_maya
looks like easy_install failed to pull down a missing module 'markupsafe' which seems to have fixed it. all building now.

thanks guys, going to take a look at mock this week I think.




--
Marcus Ottosson
konstr...@gmail.com

--
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+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages