UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor chughy
Visitor
490 Views
Registered: ‎06-10-2019

Using Python within TCL script in Vivado 2019.1

Hello!

I'm having problems using Python within TCL in the same build scripts I have been using for ages. Since I installed Vivado 2019.1 it seems to call a built in Python 2.7.5 in Vivado (which is broken), not my installed versions. I've tried using the Python installation path directly to no avail - anyone having a similar problem or know a way around this?

Tags (4)
0 Kudos
9 Replies
Xilinx Employee
Xilinx Employee
442 Views
Registered: ‎05-14-2008

Re: Using Python within TCL script in Vivado 2019.1

Could you post more details about what error/phenomenon you encountered?

-vivian

-------------------------------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 Kudos
Visitor chughy
Visitor
425 Views
Registered: ‎06-10-2019

Re: Using Python within TCL script in Vivado 2019.1

Sure... I've only tested this on Windows 10, and it appears that all Python scripts called from within the Vivado TCL environment are intercepted and instead use the following:

C:\Xilinx\Vivado\2019.1\tps\win64\python-2.7.5

Obviously the install location may be different... it doesn't matter how I try to specify the Python install path, it always utilizes the Xilinx packaged interpreter.

The error occurs within the GUI and on the command line (cygwin or DOS); the GUI error occurs in my situation post synthesis when executing a tcl.post script that calls a Python sort logs script. The command line error is similar and occurs at any point within the Vivado TCL shell - the following screenshot is an extremely simple example to demonstrate the bug:error.JPG

I have tried callling the install paths directly (even is desperation as a variable) to no avail.

0 Kudos
Visitor chughy
Visitor
424 Views
Registered: ‎06-10-2019

Re: Using Python within TCL script in Vivado 2019.1

The simple example in 2018.3.1:works.JPG

At least the last few versions before work as well.

0 Kudos
Xilinx Employee
Xilinx Employee
400 Views
Registered: ‎05-14-2008

Re: Using Python within TCL script in Vivado 2019.1

Could you share your .tcl and .py scripts so that I can reproduce the issue at my end?

-vivian

-------------------------------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 Kudos
Scholar watari
Scholar
390 Views
Registered: ‎06-16-2013

Re: Using Python within TCL script in Vivado 2019.1

Hi @chughy 

 

Would you modify content at line 123 in <install dir>/tps/<win64 or lnx64>/python-2.7.5/lib/python2.7/encodings/__init

__.py as below ?

 

# original

raise CodecRegistryError,\

# revise

raise CodecRegistryError, \

 

Best regards,

 

0 Kudos
Visitor chughy
Visitor
358 Views
Registered: ‎06-10-2019

Re: Using Python within TCL script in Vivado 2019.1

Watari - I actually tried that already, cheers. I also removed the line breaks in frustration, nothing.

Vivian - In my previous post I included cat commands before the script to show what they are doing. Sorry, perhaps I should have made that more clear... the command just displays the contents of the scripts to console.

Does anyone know if there is a way to simply bypass the built-in Python and use our own installation? Version 2.7.5 is really quite old anyway...

0 Kudos
Xilinx Employee
Xilinx Employee
325 Views
Registered: ‎05-14-2008

Re: Using Python within TCL script in Vivado 2019.1

The following thread may be helpful:

https://bugs.python.org/issue27054

Seems it is with environment variable settings or administrator priviledge.

-vivian

-------------------------------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 Kudos
Visitor chughy
Visitor
286 Views
Registered: ‎06-10-2019

Re: Using Python within TCL script in Vivado 2019.1

Thanks for that - it looks compelling but I think this is a different problem. Running as administrator makes no difference (in either DOS or CYGWIN shells), and as the post eventually hints on, the PYTHONHOME and PYTHONPATH environment variable are not meant to be set... unless you need to point to additional user libraries, etc.

Besides Python not working at all, the more crucial problem for me is that the Vivado interpreter forces the use of a Python version that is incompatable with a number of our companies scripts. This means even if we can get this to work, we still have a ton of re-writing to do that affects many people in many projects in many locations and isn't something easy to deploy. What I really need is a way to stop Vivado forcing a particular version and allow the user to determine the best tool for their flow.

Cheers!

Visitor amol_aeva
Visitor
58 Views
Registered: ‎01-23-2018

Re: Using Python within TCL script in Vivado 2019.1

I'm also having issues with this. Same script worked fine in 2018.3.

Its unable to import a pythong module I'm using. 

0 Kudos