Re: A global plugin problem


Lukasz Golonka
 

This cannot work since you're bundling a 64-bit version of PIL and NVDA
is running on 32-vit Pythion.
Please install a 32-bit version of Python 3.7, install PIL there, copy
its files into your plugin and retry.

On Sun, 16 Jan 2022 17:22:36 -0500
"Ken Perry" <kperry@...> wrote:


Here is a link to the broken Graphiti plugin. I think you will see I have what you say in the code. It does not work.


The link to the graphiti plugin

https://www.dropbox.com/s/ckj23wr2xsop7ov/graphiti.zip?dl=0

-----Original Message-----
From: nvda-addons@nvda-addons.groups.io <nvda-addons@nvda-addons.groups.io> On Behalf Of Lukasz Golonka via groups.io
Sent: Sunday, January 16, 2022 4:20 PM
To: nvda-addons@nvda-addons.groups.io
Subject: Re: [nvda-addons] A global plugin problem

I've bundled pillow with my OCR add-on for Python 3 based NVDA successfully in the past, so this is certainly possible. My folder layout was as you've described i.e:
- A folder in the golbalPlugins folder of my add-on
- Inside it a __init__.py and an PIL folder.

In __init__.py I had the following code:

PLUGIN_DIR = os.path.dirname(__file__)

# Pillow requires pathlib which is not bundled with NVDA # Therefore place it in the plugin directory and add it temporarily to PYTHONPATH
sys.path.append(PLUGIN_DIR)
from .PIL import ImageGrab
from .PIL import Image
del sys.path[-1]

If you want feel free to send a zip file of the plugin and I can take a look.


--
HTH
Lukasz

On Sun, 16 Jan 2022 16:02:21 -0500
"Ken Perry" <kperry@...> wrote:

Ah Ok to be clear about the whole process.

I have created a Graphiti folder which will be a global plugin. This
plugin worked in the past. It is currently under scratchpad global plugins.

I used pip in my windows python3.7.2 since that is what I saw NVDA was
using to pip install pillow and aenum. My test program to do what I
want the plugin to do works fine outside of NVDA.

I Then copied pil, a pil folder from site-packages, pillow dist file
and aenum from the site-packages folder and an aenum file into the
graphiti folder.
I also have one Graphiti.py in the graphiti folder that is the code
that controls the graphiti. Finally I have the script for NVDA
__init__.py

All of that is in the graphiti folder. I copied it using the windows GUI
copy so it should have copied the entire folder. I do wish that NVDA
had a pip of its own or some system that add-ons or plugins could add
libraries without copying.

This all worked in the older nvda. Again I test by commenting out the
librarys and the plugin is definitely being activated because I can
see my messages. I am more than willing to zip this up if experts out
there think they can see the problem.

Ken



-----Original Message-----
From: nvda-addons@nvda-addons.groups.io
<nvda-addons@nvda-addons.groups.io>
On Behalf Of Alberto Buffolino
Sent: Sunday, January 16, 2022 1:54 PM
To: nvda-addons@nvda-addons.groups.io
Subject: Re: [nvda-addons] A global plugin problem

Ken Perry, il 16/01/2022 19.34, ha scritto:
Scratchpad is not for simple modules it is for developing modules of
any
kind as far as I know.
Alberto:
I'm not sure, I remember errors on absence of GlobalPlugin class, like
if NVDA would want to find only NVDA modules, and to redistribute you
should change folder structure and code accordingly, so... but ok,
this is a my personal opinion.
" About PIL/Pillow, what procedure you have follow to collect its files?"
I don't understand what your asking here.
Alberto:
I'm asking what actions you have done to populate PIL folder, or where
you copied it from.
Have you installed it via pip and then copied some files? Or have you
downloaded Pillow-9.0.0-cp37-cp37m-win32.whl from Pypi and then
extracted the PIL folder?
I suspect the latter is a good procedure, but I not tested yet.
Alberto



















--
Regards
Lukasz

Join {nvda-addons@nvda-addons.groups.io to automatically receive all group messages.