Importing modules into Python within linux

Previous topic - Next topic

henrylaw

I am writing a scripter program that will take text from the clipboard, do some reformatting and then insert it into a text frame. To do this I'm trying to import 'pyperscript'.  Environment is Linux Mint 22.3

I code

  import pyperscript

... and get the message

  ModuleNotFoundError: No module named 'pyperclip'

The module is installed; I have test programs, run from the command line, that find and execute it.

Reading up, I think I understand that the python interpreter in Scribus has its own "sys.path", so I wrote a simple routine which prints that out; right enough it doesn't contain /usr/lib/python3/dist-packages, which is where "pyperclip" lives.  It does contain /usr/lib/python3.12/site-packages, so I experimented with

  sudo ln -s /usr/lib/python3/dist-packages/pyperclip /usr/lib/python3.12/site-packages/pyperclip

(and had to create /usr/lib/python3.12/site-packages in the process). But the module is still not found.

Is there a way to do what I want to do?