You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: user_guide.md
+17-2
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The idea in VUnit is to have a single point of entry for compiling and running a
6
6
## Python Interface
7
7
8
8
The public interface of VUnit is exposed through the `VUnit` class
9
-
that can be imported directly from the vunit module. To make VUnit visible to Python you need a PYTHONPATH environment variable which includes the path to the VUnit root directory containing this user guide. Note that you shouldn't point to the vunit directory within the root directory.
9
+
that can be imported directly from the vunit module. Read [this](#making-vunit-importable)to make VUnit visible to Python.
- Extra arguments passed to `vsim` when loading the design in GUI mode where it takes precedence over `vsim_extra_args`.
281
281
282
-
###Ctrl-C when using Git/MSYS Bash on Windows
282
+
## Ctrl-C when using Git/MSYS Bash on Windows
283
283
VUnit will catch Ctrl-C and perform a clean shutdown closing all started simulation processes and printing the test report so far. On Git/MSYS Bash on Windows however there is a mechanism that hard kills a process a very short time after pressing Ctrl-C often prohibiting VUnit from completing its shutdown. This can leave simulation process open which have to be manually killed. See this [stack overflow post](http://stackoverflow.com/questions/23678045/control-c-kills-ipython-in-git-bash-on-windows-7) for tips on how to remove this mechanism.
284
+
285
+
## Making VUnit importable
286
+
To be able to import VUnit in your `run.py` script you need to make it visible to Python or else the following error occurs:
287
+
```console
288
+
Traceback (most recent call last):
289
+
File "run.py", line 2, in <module>
290
+
from vunit import VUnit
291
+
ImportError: No module named vunit
292
+
```
293
+
294
+
There are two methods to make VUnit importable in your `run.py` script:
295
+
296
+
1. Set the `PYTHONPATH` environment variable to include the path to the VUnit root directory containing this user guide. Note that you shouldn't point to the vunit directory within the root directory.
297
+
298
+
2. Add a `import sys; sys.path.append("/path/to/vunit_root/")` statement in your `run.py` file **before** the `import vunit` statement.
0 commit comments