I am trying to convert the vcd file to wavedrom json file using the python library
https://github.com/Toroid-io/vcd2wavedrom
when I run on my terminal the below code works fine
source /var/www/xxx/vcd2wavedrom/verilog-env/bin/activate &&
python3 /var/www/xxx/vcd2wavedrom/vcd2wavedrom/vcd2wavedrom.py
-i /var/www/xxx/uuids/abcd/dump.vcd
-o /var/www/xxx/uuids/abcd/dump.json
When i execute the same code in my php script as
$env = 'source /var/www/xxx/vcd2wavedrom/verilog-env/bin/activate';
cmd = "python3 /var/www/xxx/vcd2wavedrom/vcd2wavedrom/vcd2wavedrom.py -i ".$uuid_dir."/dump.vcd -o ".$uuid_dir."/dump.json";
#!/bin/sh
shell_exec($env ." && ". $cmd);
I am getting sh: 1: source: not found error.
How can set the venv from php script.
I am not a python developer. Please elaborate your answer as much as possible for me to understand better.
I tried to remove the source, but I got
sh: 1: /var/www/xxx/vcd2wavedrom/verilog-env/bin/activate: Permission denied
Traceback (most recent call last):
File "/var/www/xxx/vcd2wavedrom/vcd2wavedrom/vcd2wavedrom.py", line 9, in <module>
from vcdvcd.vcdvcd import VCDVCD
ModuleNotFoundError: No module named 'vcdvcd'
I set verilog-env folder to 777 but still the same error persists
Answer
I ran
pip install vcdvcd --break-system-packages
referring to
/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3[]
and removed the venv setup
$env = '/var/www/xxx/vcd2wavedrom/verilog-env/bin/python3';
$cmd = "python3 /var/www/xxx/vcd2wavedrom/vcd2wavedrom/vcd2wavedrom.py -i ".$uuid_dir."/dump.vcd -o ".$uuid_dir."/dump.json";
shell_exec($cmd);
Now I am getting the output. Is it proper?
4