Scribus Forums

Scribus => Scripts and Plugins => Topic started by: michaelu on November 02, 2019, 07:25:42 PM

Title: scribus and virtualenv
Post by: michaelu on November 02, 2019, 07:25:42 PM
Hi, I am already using scribus with python3 (svn changes from end of September 2019). I have python code running in a virtual environment, some modules only in venv/Lib/site-packages. I expected Scribus to pick up these libraries when started from a virtual environment, but it doesn't.
a.l.e. proposes something in http://forums.scribus.net/index.php/topic,3279.msg15325.html , but I do not understand this, and execfile also does not exist in python3.
Creating a scribus.bat file with the content

set PATH=...\venv\Scripts;.;%PATH%
set VIRTUAL_ENV=...\venv
scribus.exe

does also not help. Why not? What does help?
Title: Re: scribus and virtualenv
Post by: a.l.e on November 02, 2019, 09:08:33 PM
i remember that i did try something, but i don't think that i did find a solution.
but what i wanted to reach at that time was to activate the venv from inside the python scripts that runs in scribus...

i just did a try on linux and starting scribus from a terminal that has the venv activated seems to work correctly.
if you have tried from cmd, you might want to try from a bash shell (as an example the one installed by git...)

maybe somebody who uses windows more often than me can give further advice...

ciao
a.l.e
Title: Re: scribus and virtualenv
Post by: a.l.e on November 22, 2019, 09:52:33 AM
hi michael

a few days ago i've tried to read exif data from a python script that runs from inside of scribus.

on linux, starting scribus from a terminal with an active virtual environment allowed me to import the "local" libraries while running the script inside of scribus.

it seems to really work...

ciao
a.l.e
Title: Re: scribus and virtualenv
Post by: michaelu on November 22, 2019, 08:45:56 PM
I looked more deeply into this. After some trials and errors this scribus.bat worked:

set VIRTUAL_ENV=...\venv
set PATH=%VIRTUAL_ENV%\Scripts;.;%PATH%
set PYTHONPATH=%VIRTUAL_ENV%\Lib\site-packages


Not sure what is going on. But Scribus 1.5.6.svn does not call python.exe, but python37.dll, and the PATH seems to be ignored.