[New Feature Preview] Python 3 Support Issue Thread

Hello @c.poupin. Thanks for reporting. Your observation is correct, there is a conceptual difference between engines that goes beyond Python syntax. We are currently working on reducing the exposure of those differences to users.

This case in particular worked for me in the latest daily build of Dynamo. Please give it a try and let us know if there is something we missed. Thanks again for reaching out!


Thanks it’s works now, even with a recasting :slight_smile:


Here are a few things I have ran across, but perhaps these are all expected changes as well and I am just not familiar with CP3 to know.

I have found that the reference imports do not go as deep as they did in 2.7. For instance, this worked great in 2.7, but in CP3 I had to use ‘Visual.Generic’ inline to get to the depth I needed.


Also just a note that the ImportExtentions does not work as it did:

One other thing that could be nice for the converter would be “string.Contains” to if ‘char’ in str: since str.Contains(‘char’) doesn’t appear to work.

Another element for the converter may be list.Add to list.append

It also seems to be pretty slow and spins for a few moments when trying to Load up the autocomplete suggestions for imports etc. Previously you could keep typing, but now it stops, spins, spins, waits, then gives you a list.

1 Like

Thanks for the feedback @SeanP! We’ll get this into our backlog :slight_smile:

cc @Michael_Kirschner2 @Qilong_Tang @Aparajit_Pratap

1 Like

Hello some explanation

Basic Pythonnet package doesn’t implement this clr method (and others as IronPython, only GetClrType method as been implemented since 2017 ( Higher compatibility of the clr module with IronPython)

Anoter example we can’t use clr.Reference for pass a method as parameter
example here Link DWGs in Drafting Views?
the workaround is using Reflection.

Pythonnet does not convert all python objects to CLR objects dynamically, some objects need a cast to use Net methods

Basic (additions are possible) Pythonnet’s Net implementation is nowhere near as good as Ironpython


in latest daily builds we have added ImportExtensions support.


We have now improved this process :slight_smile: Please have a look at the following link! https://github.com/DynamoDS/Dynamo/wiki/Customizing-Dynamo’s-Python-3-installation where we show you how to use Python 3 modules without having to install Anaconda.


@solamour Thank you for the link!

1 Like

Most welcome @Cezmi - it’s hot off the press this morning :smiley:

1 Like

some remarks with Dynamo 2.8 (but which are rather related to PythonNet)

  • Problem with auto-completion (native Python list has no “Add” method and PythonNet does not dynamically convert to NetList )

  • refs and out Parameter does not work (missing in PythonNet, I don’t know if you have the possibility to integrate it, or if there is a possibility of workaround)

  • Ditto for COM interfaces (missing in PythonNet, force to use reflection)

solution with Reflection without a wrapper

Note: clr.AddReferenceByName method does not exist under Pythonnet

I imagine that resolving Net compatibilities with de Pythonnet (especially coming from IronPython) should not be easy


Hi @c.poupin. You posted quite a few things there, let me go one by one.

As you noticed, autocompletion for the CPython3 engine currently relies on the same mechanism used for the IronPython2 engine. Having an autocompletion engine specific for the new engine is currently on the works, but it didn’t make it to Dynamo 2.8.

Ref and Out
These two actually work with PythonNET but the way they do is not like in Iron Python and unexpected in my opinion. The ref/out parameters need to be provided but they are considered as inputs only. The output is actually obtained from the result of the function call, which is surprisingly a Python tuple. Here are a couple of examples showing this:

Out parameter in Dictionary.TryGetValue

Ref parameter in Interlocked.Exchange

COM interop
For this one I don’t have a better workaround than yours, so I will have to cheat :slight_smile:
Here is an example using Dynamo’s own .NET classes to help interact with Excel. Unfortunately
some of these functions are not public, but the idea can be used with a custom library that is part of a package for instance. That helps overcome the limitations regarding COM interop in PythonNET.

Thank you so much for the feedback @c.poupin. We will update our documentation with the issues you provided so that people can use it as reference in case they find themselves against them.


@martin.misol thank you for this feedback, especially for the explanation of the ref/out parameters.


You are welcome @c.poupin :slight_smile:

Just wanted to add an alternative for COM interop. This can be achieved also using Python --> COM integration, without going through .NET. There is a module called pywin32 that serves this purpose. Here is an example equivalent to the one I showed before but using this pywin32 instead of relying on a custom .NET library.


Hi @ustncz. I tried and got the same error you did. I think it’s because we are running Python from .NET, so the threading mode is already initialized.
I was actually able to use the library if I commented out the offending line, where CoInitializeEx is called.

Not sure if that causes other issues down the road, so please beware.


Oh my GOD! I should have come to you much earlier!! You saved me!!

Thank you very much!!

1 Like

Unsure if this is an actual error, or if it’s Error 45 (the error is 45 cm from the screen…)
I’ve followed the guidelines here to the point: Customizing Dynamo's Python 3 installation · DynamoDS/Dynamo Wiki · GitHub
and have been able to succesfully install ie pandas and numpy through pip.
Trying to use any of the modules gives me error messages like this one:

Are there any limitations or mishaps in my sparse code that I’m unaware of? Or is it something else completely?

I am not an expert here and haven’t tried myself, but perhaps try changing line 13 to plt.pyplot.plot(lst,lst) and see where you get (would be a 45 degree line on a line chart if I am not mistaken).

haha, you’re totally right, Jacob! :expressionless: Alas, the error was indeed off screen…
Here is a piece of the Mandelbrot fractal to cheer my self up:


Nah - this is more of a ‘wait this didn’t work, is it the code or the implementation?’ thing which the community is here for. :slight_smile:

For reference, any issues I have seen have warnings like now ‘library of that name found,’ and will throw the error early when you do your imports (assuming you do them together and early), but your mileage may vary. :smiley:

1 Like