Maya 2023 Python 2

I get this error and I think it's because of python3 Error: AttributeError: file C:\Program Files\Autodesk\Maya2023\Python\lib\site-packages\pymel\tools\mel2py\melparse.py line 438: 'str' object has no attribute 'lineno'

import pymel.tools.mel2py as mel2py
pythonCode = mel2py.mel2pyStr( """
setDrivenKeyframe -currentDriver pCube1.translateY pCube2.translateX;
setDrivenKeyframe -currentDriver pCube1.translateY pCube2.translateY;
setDrivenKeyframe -currentDriver pCube1.translateY pCube2.translateZ;
""",pymelNamespace='pm')
print( pythonCode )

asked Sep 9 at 2:49

I believe the issue is down to how you're formatting the mel command string. If you use the code below it should function:

import pymel.tools.mel2py as mel2py
mel_command = 'setDrivenKeyframe "-currentDriver pCube1.translateY pCube2.translateX";setDrivenKeyframe "-currentDriver pCube1.translateY pCube2.translateY";setDrivenKeyframe "-currentDriver pCube1.translateY pCube2.translateZ";'
pythonCode = mel2py.mel2pyStr(mel_command, pymelNamespace='pm')
print(pythonCode)

answered Sep 9 at 8:50

GreymanicGreymanic

1181 silver badge6 bronze badges

A simple solution is to launch a maya2019 or maya2018 version prior to maya2022 and use mel2py there.

answered Sep 24 at 19:04

Maya
Maya 2023 Python 2

Maya 2023 is shipped with Python 3.9 only on all platforms. Although pip is shipped with Maya 2023, we still can’t use it to install PyQt5 on Mac. Unlike Maya 2023 on windows, pip installed packages could work. However, it has its own Qt5 libraries installed. You may want to replace them with the ones shipped with Maya. I didn’t encounter any problems during my testing with the original pip packages. If you find any problems with it, you can... Read more →

The guide is based on What’s New in the Maya Devkit in Maya 2023 with some extra info. For more details including commands and scripts changes, please checkout the documentation for more details. Our Maya documentation team is also interested to know how impactful Developer documentation improvements have been over the past few releases. If you have a moment, please take this short survey to help us improve and know what is most important for you. Building environments The building... Read more →

How to build and install PyQt5 for Maya 2022 Python 3. Read more →

Maya 2022 API Update guide The guide is based on What's New in the Maya Devkit in Maya 2022 with some extra info. Check the Maya documentation for the most up to date information. Build environment: The build environments have been upgraded. Mac still uses Mojave 10.14.x with Xcode 10.x, and Windows remains Windows 10 with an upgrade to VS2019. Linux has been updated to CentOS/RHEL 7.6 or above and DTS 9.1. Platform OS Compiler Windows Windows 10 x64 Visual... Read more →

With the release of Maya 2020, there was a minor change to the IMF library names. It was previously named IMFbase.lib, but it’s been changed to adskIMF.lib. This caused a few problems in producing the DevKit and even in the Maya lib installation folder. For both the Linux and Windows platforms, the IMF library file is missing in the DevKit and Maya installation folder. For Mac OS, the IMF library was included with the Maya installation, but is missing in... Read more →

The guide is based on What's New in the Maya Devkit in Maya 2020 with some extra info. Check the Maya documentation for the most up to date information. For Mac users, Apple has introduced notarization since OS X 10.14.5 and it is going to be enforced for Applications after 10.15. It requires the host application to declare entitlements for the plug-ins. Although Maya is the parent application, you should be aware that it may cause your plug-in to fail... Read more →

Written by Cyrille Fauvel – Autodesk Developer Network (April 2013) Updated by Chengxi Li and Lanh Hong - Autodesk Developer Network (December 2019) Building SIP and PyQt for Maya 2020 is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt website for information about licensing for PyQt... Read more →

Cached playback is a new feature that is available in Maya 2019, and it’s a major performance upgrade from previous releases. However, sometimes with new features, you may run into some issues while developing your plugins. Our engineers are actively working on building the Cached Playback API in C++ and Python which will make it easier to deal with the common issues that plugin developers are running into, and you will see those improvements in the future. Here are a... Read more →

Written by Cyrille Fauvel - Autodesk Developer Network (April 2013) Updated by Lanh Hong and Chengxi Li - Autodesk Developer Network (January 2019) Building SIP and PyQt for Maya 2019 is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt website for information about licensing for PyQt... Read more →

Maya 2019 release has been released now. Here is a guide based on What's New in API in Maya 2019 with some extra info. For more details, please check our documents here. Build environment: Windows and MacOSX remain unchanged. Linux is updated to CentOS/RHEL 7.x(x>=2) and using gcc 6.3.1 from DTS 6.1 Platform OS Compiler Windows Windows 7 x64 Visual Studio 2015 Update 3 Windows SDK Version 10.0.10586.0 Mac El Capitan 10.11.6 XCode 7.3.1 Linux CentOS/RHEL 7.x(x>=2) gcc 6.3.1(DTS 6.1)... Read more →

Autodesk just released Maya 2018 update 5 and new DevKit. You can find them at Maya Developer Center. It fixed the Mac devkit issue in previous devkit and removed a test case added accidentally (MAYA91432) . If your Update 4 devkit is working right now, you don't have to download it again. Read more →

Autodesk just released Maya 2018 update 4 and new DevKit. You can find them at Maya Developer Center. On Mac, lib files that required for building devkit plugins and standalone applications are located in Maya.app folder. This is incorrect and will be addressed in a future release. To workaround this, you can either: 1) Create a folder named "lib" under devkitBase and copy lib files from Maya.app/Contents/MacOS and Maya.app/Contents/Resources to the newly created lib folder Or 2) Update linker paths... Read more →

Having trouble with WPF sample in 2018 .net devkit? It is reported that dagexplorer command won't reopen a closed window in Maya 2018. This could be fixed with following modification: Replace MGlobal.executeCommand($@"catch (`showWindow ""{hostTitle}""`);"); with MGlobal.executeCommand($@"catch (`workspaceControl -e -visible true ""{hostTitle}""`);"); To make the window showing again. Read more →

This is an update on previous posts, for older versions, they can be found here: Maya 2017, Maya 2016 Extension 2, Maya 2016,Maya 2015, Maya 2014, Maya 2008 to 2013. Basically, the windows build environment of Maya 2018 was upgraded to Visual Studio 2015. The details are listed as follow with links. Maya 2018 Windows 64bit: Win7x64 SP1 Visual Studio 2015 Update 3(14.0.25431.01), WindowsSDKVersion=10.0.10586.0 .Net framework 4.5.1 Intel Composer XE 2016 Update 3 (16.0.3.207) Linux 64bit: RHEL/CentOS 6.5 gcc 4.8.2(DTS... Read more →

I've received a report of MRenderItem::setMatrix is not working with transform matrix recently. After doing some test, it seems to be only occurring with Maya 2018 Update 2 using OpenGL mode. Our engineers found it is an issue in code and will fix it in the future releases. Some tests in VP2 are being done in the wrong order, resulting in stale matrix data being used to render the item. We can mitigate this issue by manually querying the MDrawContext... Read more →

I have recently refreshed my working laptop to a 2016 MBP. My previous Dell is a great laptop except it is way too big and heavy to carry around with me and I need OS X environment for supporting sometimes, so I decided to make my Mac a daily working machine and my previous laptop became a supplemental machine for windows and linux platform. The new MBP comes with OS X 10.12 Sierra. When I tried to start Xcode 6.1.1... Read more →

Written by Cyrille Fauvel – Autodesk Developer Network (April 2013) Updated by Chengxi Li - Autodesk Developer Network (August 2018) Building SIP, and PyQt for Maya 2018 PyQt [https://www.riverbankcomputing.co.uk] is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt website for information about licensing for PyQt. Download... Read more →

This is a quick update for Maya 2018 Devkit since our partners are asking about this. I am sorry for the late, but the Maya 2018 Devkit is available on our ADN extranet now, if you are ADN member, you can download it there directly. We are also working on to upload it to Autodesk App Store and Maya Developer Center, I will update the progress here. Read more →

This is a short update regarding the Maya 2018 devkit. As-is typical for the devkit, it can take a few days to get it posted after our Maya product release. We are awaiting the official release from engineering and they have told us it should be ready in the next few days. Once we receive it, we will get it posted ASAP. Please check back here for the latest information. Thank you for your patience. Read more →

Maya 2023 Python 2

Another big time for the 2018 release of M&E products, the following products are released on July 25: Maya 2018 Arnold SDK 5.0 MotionBuilder 2018 Mudbox 2018 Entertainment Creation Suite Ultimate 2018 Maya Entertainment Creation Suite Standard 2018 3ds Max Entertainment Creation Suite Standard 2018 Maya 2018 with Softimage For our 3rd party developers, it means you should check out the new APIs and upgrade your plugin to support the latest versions. If you are in our Beta forum, you... Read more →

Written by Cyrille Fauvel – Autodesk Developer Network (April 2013) Updated by Vijaya Prakash – Autodesk Developer Network (November 2016) Chengxi Li - Autodesk Developer Network (June 2017) Building SIP, and PyQt for Maya 2017 PyQt [https://www.riverbankcomputing.co.uk] is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt... Read more →

We received a report that footprint samples aren't working properly. It turns out that the depthPriority wasn't implemented correctly. The original samples are using fixed depth(5) and when the node is duplicated, the old one is still on top of it. We can determine a proper depth with MGeometryUtilities::displayStatus. unsigned int depthPriority; switch(MHWRender::MGeometryUtilities::displayStatus(path)) { case MHWRender::kLead: case MHWRender::kActive: case MHWRender::kHilite: case MHWRender::kActiveComponent: depthPriority = MHWRender::MRenderItem::sActiveWireDepthPriority; break; default: depthPriority = MHWRender::MRenderItem::sDormantFilledDepthPriority; break; } You also have to replace the depth settings.... Read more →

If you are wondering why your fancy geometry created with MPxSurfaceShape is not working in renderers like Arnold, then this article is for you. Before rendering them, you'll need to create a translator or shader for your renderer. For Arnold, it can be handled using extensions. To make a 3rd-party plugin work with Arnold, you'll need to write translator extension for it.There are three SDKs you are going to refer to in your project. Arnold SDK, mtoa SDK and Maya... Read more →

Pillow is a Python image library with several other libraries built-in. Because it is originally built with VC2008, we can't use the wheel package with Maya. We'll need to build it manually. I wrote this blog for Maya 2017 at first. For Maya 2018, please use replace building environment with VS2015 and Windows SDK 8.1. Requirements VS2012 update 4 CMake > 3.3 Python 2.7.11 source code Windows SDK 7.1A Preparation Before we build Pillow, we need to install setup tools.... Read more →

With last post we talked about the Best practices while migrating your plugin to Parallel Evaluation, in this post, we will talk about the following 2 new methods, and how to make use of them to improve the performance: MPxNode::preEvaluation MPxNode::postEvaluation Within the old DG system, because MPxNode::setDependentsDirty function is called during dirty propagation, it can be used to manage attribute dirtying, and sometimes, we can cache the computed data in this method to avoid expensive calculations in MPxNode::compute. Let’s... Read more →

As we know, starting from Maya 2016, Maya introduces a new evaluation model that enabled better utilization of computer resources by distributing computation over all available cores and taking advantage of GPU compute power. Unlike previous versions of Maya, which was limited to node-level parallelisms, Maya now includes a mechanism for scene-level analysis and parallelization. For example, if your scene contains different characters that are unconstrained to one another, Maya can evaluates each character at the same time. At the... Read more →

Render setup is very useful for managing render layers and it can import and export render layers for later usage. However, the information on how to import/export it in Python is quite sparse. After doing some research on our testing code, I found that it is quite easy. There is renderSetup.decode and renderSetup.encode for import and export, respectively. The prototype for decode is decode(jsonObject, importOption, optionalPrefix), where - the jsonObject is the json string you'll need to import; - the... Read more →

We were asked some array questions recently, and I found that there isn't a good sample in Maya devkit. This article will demonstrate how to initialize an array with MArrayDataBuilder. MPxNode::Compute isn't a good choice to give your array a default value. The reasons are that the compute will be called after a plug is dirty, or it will be connected on demand. The proper way to give your array a default value is to use the MPxNode::postConstructor method. For... Read more →

Sometimes we want to use a node as input for our custom nodes, and would like our custom node to be updated whenever our input is changed. Usually, we will create a message attribute with MFnMessageAttribute on our custom node and register callbacks to deal with it. The message attributes will never participate in dirty propagation, it is only for making connections. For example, sometimes we would like to connect a camera to our custom node and update it with... Read more →

Some of you may already know about this, but I think I still need to emphasize it again here. In the past, we used to have Service Packs and Extensions after the Maya main release. But starting from Maya 2017, we will not provide Service Packs or Extensions any more, instead, will use Maya Updates to maintain and update the software regularly, providing new features, and quicker fixes to customer issues. For our plugin developers, one important thing you should... Read more →

It’s really a big month for Autodesk M&E customers and partners. Why do I say that? Here are the new versions of products that were just released within this month: Autodesk Stingray 1.6 version. Stingray 1.6 is now available for download via your Autodesk Account, Autodesk Knowledge Network, and Steam. For more information about this update version, please refer to the Stingray V1.6 Release Notes in the online documentation. Stingray 1.6 also includes the FBX SDK 2017.1 security update. Autodesk... Read more →

The last main improvement for Render Setup feature is actually a new feature to render a sequence directly from Maya’s UI without executing a batch render (including support for loading the sequence in the Renderview for review), thanks to engineering team’s contribution, here is the detail if you are interested: Introduction Rendering of image sequences in Maya has traditionally been an offline process for the end-user via command-line or the batch render feature in Maya. This can be limiting for... Read more →

The 2nd main improvement is about changes to render settings window callbacks to support the new workspaces UI feature, as I mentioned before, this information is also provided by our engineering team. Let’s take a look at the improvement. Introduction One of the changes introduced in Maya 2017 is the new workspaces feature. This feature includes a change that presents some problems for the Render Settings. Maya now retains the state of windows that were open in previous sessions of... Read more →

Recently we were asked how to implement super sampling for a viewport render override. It requires you to create new render targets to replace the original ones. The MRT sample is very good at showing how to do it, however it is too complex to begin with. So we'll create a new one based on the simplest sample - viewOverrideSimple. The full code can be found on GitHub here. The original sample has three render operations: scene, HUD and present.... Read more →

In Maya 2017, there are 4 new API’s are exposed in MPxSelectionContext class namely setAllowPreSelectHilight(), setAllowSoftSelect(), setAllowSymmetry(), setAllowDoubleClickAction(). Please go through the following link for how to use the selection tool. https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/Maya/files/GUID-60FD5F79-AC1D-46DE-B66D-2FBE73E15A30-htm.html In UI method, you can enable/disable and use all the selection methods. However, it is possible to use the same functionalities using MEL and C++ API. MEL way to enable/disable Soft Selection: Soft modelling is an option that allows for reflection of basic manipulator actions such as move,... Read more →

As you know in Maya 2016 Extension 2 we introduced the replacement for Maya render layers called “Render Setup”, during that period we introduced this feature to several 3rd party renderers in person. For Maya 2017 we have been making improvements to this feature that will allow for improved support for 3rd party renderers, and other recent changes have the potential to impact 3rd party renderers as well, will talk about the 3 improvements in the following separate blogs, and... Read more →

We have encountered two simple API changes recently, but they each can cause some confusion. Image Sample issues The first one is the image extension sample in Maya devkit. It is used for creating image extension for adding extra image format support in Maya. It is located in devkit/image folder. It appears above mentioned sample and its document haven't been updated for a while, and there are two small issues inside of it. Imf.lib is renamed to imfbase.lib now and... Read more →

Starting from Maya 2017, the Maya team introduced a great improvement to the XGen feature, called “Interactive hair and fur grooming with XGen”. The improvement provides a full range of tools, including sculpting brushes, modifiers, and sculpting layers, dedicated to creating all styles of hair and fur. Interactive grooming descriptions and modifiers are Maya-based nodes, and therefore they can be manipulated in the Node Editor. The cool thing is that these nodes are computed on your system's GPU instead of... Read more →

Extension attributes are really helpful when plugin developers want to add more attributes to a plugin without modifying the existing plugin code. In Maya, there are many ways to add/remove the extension attributes like MEL way, Python way and C++ API way as well. MEL Way to add/remove extension attributes: To add extension attribute, use addExtension command To remove extension attribute, use deleteExtension command To list only extension attribute of an object use "listAttr -ex object" Example: // Create unknown... Read more →

Well, it’s pretty easy to add a command into Maya, and I also believe most of our plugin developers know how to add a context/tool within Maya (Context is actually presented with the name “tool” in Maya), if you are not familiar with that, please refer the Command plug-ins section of help doc for the details. In general, contexts in Maya are modes which define how mouse interaction will be interpreted. A context can execute commands, modify the current selection,... Read more →

While working with Maya, sometimes, we create a set to handle multiple elements as a whole. We can add DG nodes, DAG components or plugs to the set and MFnSet is used to operate with the set, but there is one trap with the API that you need to know. Most of time, the API works well, the issue only happens when checking for a given DAG node component by MFnSet::isMember(const MDagPath& path, const MObject& component, MStatus* st). Currently, if... Read more →

This is an updated version for Maya 2016.5' PyQt build instructions. This is an updated version of the Maya 2016 build instructions for PyQt and PySide (here). The very good news is that with Maya 2014 & onward, there is no more need to build PySide as it is coming by default in Maya :) libxml, openSSL, OpenAL, python2.7, qt-4.8.5-64 / Maya 2014/2015, qt-4.8.6-64 / Maya 2016 and tbb are also coming by default in the Maya include and lib... Read more →

If you use MPxDrawOverride class to override the draw of your custom locator class, you will have to register the draw override as below: static MString drawdb("drawdb/geometry/light/customLight"); static MString sDrawRegistrantId("customLightDraw"); plugin.registerNode("customLight", customLightNode::m_id, customLightNode::creator, customLightNode::initialize, MPxNode::kLocatorNode, &drawdb); MHWRender::MDrawRegistry::registerDrawOverrideCreator(drawdb, sDrawRegistrantId, MCustomLightDrawOverride::Creator); However, if you want your locator to be classified as light with the same drawdb as above, Maya won't treat your locator as light, because the above drawdb string is applicable only for geometry override not for light. The node will... Read more →

When you write a Shader Fragment, you should use the right naming conventions. For example if you check parameters like “mayaUvCoordSemantic” the name should be “uvCoord”, for “tangent” the name should be “mayaTangentIn”. Even if you check the “Object Space Position” the name and the semantic both should be “Pm”. Check the below example. " "

What version of Python does Maya 2023 use?

Maya 2023 now uses Python 3 exclusively.

How do I run Python 2 in Maya?

Maya on Windows and Linux starts in Python 3 mode by default. It can be switched to Python 2 mode by either using the -pythonver 2 option when starting Maya from the command line, or by setting the MAYA_PYTHON_VERSION environment variable to 2 before starting Maya from the command line.

Does Maya use Python 2 or 3?

Maya now supports Python 3 exclusively, and the version of PyMEL used with Maya has been updated to 1.3. Maya uses Python version 3.9. If you have plug-ins or scripts written in Python 3.7, you may encounter issues when porting them to Python 3.9 as code compatibility is not guaranteed between these two versions.

What Python version does Maya 2022 use?

Maya on Windows and Linux now starts in Python 3 mode by default. Python 3 is available on all platforms. On Windows and Linux, Maya can still be started in Python 2 mode by following the instructions in the updated Python in Maya section.