Python 2.7 and 3.x and 3DEqualizer R7+ Support
david-cattermole opened this issue · 10 comments
Problem
3DEqualizer R7.0 requires Python 3.7 support for all Python scripts.
It has been reported by users the 3DEqualizer scripts that come with mmSolver do not work in 3DEqualizer R7.0.
All 3DE python scripts must be ported to work in Python 2.7 and 3.x.
https://3dequalizer.com/?site=devblog&id=210516_01
Software Versions
- mmSolver version: All supported.
- Maya version: N/A
- 3DEqualizer version: R7.0 + / Python 3.7
- Operating System (OS): All
Hi David,
As we discussed, we are unable to copy or export 2D tracks from 3DE R7, sharing the error log here for visibility.
"assert isinstance(point_group, basestring) NameError: name 'basestring' is not defined"
Thanks a lot.
there are two things needed to get the scripts to work in r7:
to fix basestring error:
from past.builtins import basestring
to fix long error:
simply remove it from all isinstance
calls as in python 3 both int and long are the same type
this will make it incompatible with python 2.7 though.
Thanks for the heads up @p0las.
I'm sure I could wrap the from past.builtins import basestring
in a try/except or if conditional based on the version number. That should make it backwards compatible with 2.7, and for 3.x I could assign long
as an alias for int
.
This combined with using the __futures__
module should fix most issues and stay compatible.
@david-cattermole of course you can. you can also use six
library to make it compatible with both python versions. I was going to submit a pull request but we ended up moving to r7 completely so I never updated your code to make it backward compatible.
@p0las after doing some research, it seems past
is a third-party Python module, same as six
, and not distributed with standard Python as I assumed above.
Therefore if using these modules I'll either need to include copies of the modules, or not use them and white my own workarounds.
My goal is to avoid any need for users to install any other software - the scripts should be fully self-contained.
Am I wrong about this? Do you have any suggestions for this? I'm guessing in your situation (at a studio?) your pipeline team had installed the needed modules?
you are right @david-cattermole six
package is a third-party. I thought past
was part of the python 3 release but I might be wrong. In our pipeline, we do have a bunch of packages available in the environment and it is easy for us to rely on them. if you want to have a clean distribution with no dependencies you will need to find a different way to deal with basestring. long could be mapped to int in a try/except. you could try to map basestring to str the same way.
Hello everyone,
I have added the Python 3 for the tools to work with 3DEqualizer R7, and they will also work with older releases of 3DEqualizer.
Unfortunately I'm unable to test this myself, can someone please download and test these files in 3DE4 R6 and R7?
Simply download the following files and overwrite your current files, or add them to your ~/.3dequalizer/py_scripts
directory as normal:
If you have feedback, please let me know on this issue (preferred), or via email.
David
I've now had feedback the above code is working with 3DEqualizer Release 7 (with Python 3).
I just need to confirm Release 6 (Python 2) is working.
The Paste Camera tool script was broken in the above comment.
This file should be used instead and also sets the Camera Playback range (#236):
https://raw.githubusercontent.com/david-cattermole/mayaMatchMoveSolver/ac67efce2c8b914a21baae89a74cdbc024d20f4e/3dequalizer/scriptdb/paste_camera_mmsolver.py
This has been tested with a 3DEqualizer Python 2 release, but not Python 3 (Release 7), yet.
If someone reading this has access to Release 7 and can test, please let me know.
The above "Copy and Export Tracks" tools have been tested in a Python 2 environment (but not 3DE Release 6), and I will consider them to be working. I have had confirmation that the same scripts work in Python 3 (Release 7).
The "Paste Camera" tool is the only tool that has not been tested in Python 3 (Release 7), however since this does not break any currently supported 3DE versions I will release it.
I consider this ready for release in v0.3.15, but will re-open if a problem is found.