Skip to content

Commit 59a0f6b

Browse files
committed
Update user_guide.md
1 parent bbb3fe3 commit 59a0f6b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

user_guide.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The idea in VUnit is to have a single point of entry for compiling and running a
66
## Python Interface
77

88
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.
1010

1111
```python
1212
# file: run.py
@@ -279,5 +279,20 @@ vu.set_sim_option("vsim_extra_args.gui", "-voptargs=+acc")
279279
* `vsim_extra_args.gui`
280280
- Extra arguments passed to `vsim` when loading the design in GUI mode where it takes precedence over `vsim_extra_args`.
281281

282-
### Ctrl-C when using Git/MSYS Bash on Windows
282+
## Ctrl-C when using Git/MSYS Bash on Windows
283283
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

Comments
 (0)