I’ve used python script in dynamo to write some code but I really that I need to import some py script from python34. I copied and pasted a py file from Python34 into IronPython2.7 but when I import that py file, it doesn’t work. So could you guys help me with this.
Hi,
We wannot help you if you do not provide at least a screenshot of your code with the error you get. So many errors can happen…
One ‘‘error’’ is that the syntax is not the same in python 2.7 and 3.x…
Guys, I know that ironpython and python have its own Lib but there are some modules that they overlapped each other so I’ve come up with a crazy idea that I copy and paste all Python34\Lib into Ironpython2.7\Lib. With that idea I can import in ironpython like in python34. Is that a good idea, guys? I’m afraid of losing some import data in some module which can ruin ironpython2.7\Lib.
I am afraid this doesn’t work like that. Bad idea.
I figure out that when i use :
import sys
sys.path.append(’…’)
import …
I could import anything from ironpython2.7/Lib
and have you ever tried my idea before?
I am saying its a bad idea to copy/paste a library folder from Python 3.4 into library folder for IronPython 2.7. These two have a bit of overlap in functionality, and some libraries will work, but for the most part, they will not. I would be more selective when doing that. If I needed the threading library I would copy that and see if it works. I would probably actually go online and download the appropriate version of that library. IronPython is built on top of Python 2.7 so get that installed first. Newer libraries will be a hit and miss exercises and for the most part a bit of a wasted time.
Yes, I believe I tried that before and it was a bad idea. It screwed up my install of IronPython and I had to wipe it clean.
You can always ask others around. @Gui_Talarico is a great Python resource.
Thanks guys, I really appreciate what you guys shared, so what if I wanna import a py script from python34 and of course, in that py script it also import many py script that didn’t exist in ironpython2.7,then I have to import that things so there are lots of things to import. So guys, could you guys show me the way to import a python file from python34 into ironpython2.7 in dynamo?
I give up.
Disclaimer: I have not tried this, I know very little about Python, and have absolutely no idea what the changes in Syntax are from Python 2(.7) to 3(.4)
A quick google search for “port python syntax 3.4 to 2.7” returns this link, which seems like it might help you:
Good luck!