Author Topic: scribus and virtualenv  (Read 2083 times)

michaelu

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
  • Scribus User
scribus and virtualenv
« on: November 02, 2019, 08: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
Code: [Select]
set PATH=...\venv\Scripts;.;%PATH%
set VIRTUAL_ENV=...\venv
scribus.exe

does also not help. Why not? What does help?

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2343
  • Karma: 33
    • the graphics lab
Re: scribus and virtualenv
« Reply #1 on: November 02, 2019, 10: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

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2343
  • Karma: 33
    • the graphics lab
Re: scribus and virtualenv
« Reply #2 on: November 22, 2019, 10: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

michaelu

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
  • Scribus User
Re: scribus and virtualenv
« Reply #3 on: November 22, 2019, 09:45:56 pm »
I looked more deeply into this. After some trials and errors this scribus.bat worked:
Code: [Select]
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.