[scribus-dev] Windows - Replacing Shipped Python Interpreter

John L. Poole jlpoole56 at gmail.com
Sat May 30 15:05:37 UTC 2015


I wanted the ability to transact with postgreSQL from within Scribus
and the Python Interpreter shipped with Scribus does not contain
the postgreSQL module: psycopg2

So, as I wrote earlier today, I hacked the Windows build to use
my installed Python vs. that shipped with the build.

Others may want to do the same, so I have created a Windows batch file
that accomplishes the necessary substitutions.

Here is the script:
-------------------------------------------
     @echo off
     ::
     :: special run of Scribus that uses Python installed on the
     :: users system that matches the build of the Python interpreter
     :: shipped with Scribus rather than the Python Interpreter shipped
     :: with Scribus' build.
     ::
     :: See: http...wiki....[Windows Replacing Shipped Python Interpreter]
     ::
     echo.
     echo Running Scribus ***without*** its shipped Python Interpreter
     echo.
     ::
     :: Hide the shipped version of the Python interpreter so Scribus 
will use
     :: the "same" version we have built on Windows
     ::
     if exist python (
         echo masking Scribus Python directory
         ren python python.SUSPEND
     )
     if exist python27.dll (
         echo masking Scribus library python.dll
         ren python27.dll python27.dll.SUSPEND
     )
     echo.
     ::
     :: point to our custom Python which should match the build of
     :: Python shipped with this version of Scribus
     :: See:
     ::
     PATH=C:\Python278;.
     ::
     ::   run it!
     ::
     echo.
     echo Launching Scribus...
     scribus.exe
     echo.
     ::
     :: undo our temporary masks so we don't run Scribus in the future
     :: forgetting that we have this special hack to replace the Python
     :: interpreter shipped with it
     ::
     if exist python.SUSPEND (
         echo restoring Scribus Python directory
         ren python.SUSPEND python
     )
     if exist python27.dll.SUSPEND (
         echo restoring Scribus library python.dll
         ren python27.dll.SUSPEND python27.dll
     )
     echo.
     ::
     :: remind our user that we're cleaning up
     ::
     pause

-------------------------------------------

Before I go public with this on the Sribus Scripting wiki, I'd like to 
see if there are any
objections or problems with this approach.

Opinions?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus-dev/attachments/20150530/49846e37/attachment.html>


More information about the scribus-dev mailing list