about pywin32

Plugins for SynWrite and CudaText...
Post Reply
SamC
Posts: 208
Joined: 12.08.2023 00:49

about pywin32

Post by SamC »

Recently, I'm writing a plugin which need to import the win32com.client module.
Then, I notice there is a plugin 'plugin.pywin32.zip' in the '\CudaText_addons\plugin', I install it, but the import raise the error below:
"ModuleNotFoundError: No module named 'win32com'
ERROR: Exception in CudaText: ModuleNotFoundError: No module named 'win32com'"
Then I check the readme.txt of that plugin, it says below. It seem it's for python3.6, and the python in cuda is 3.8, is that the reason for the error? Or I misunderstanding this plugin?
'Library "pywin32" and its requires libraries.
From https://github.com/mhammond/pywin32/releases
for Python 3.6.'
Thanks!

BTW, can markdown be used in this forum?
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Re: about pywin32

Post by main Alexey »

markdown cannot be used. forum uses BBCode as I know.

pywin32 plugin is outdated, no one used it for ages. can you update it for Py3.8 (then test it) and send me the .zip?
support(at)uvviewsoft.com
SamC
Posts: 208
Joined: 12.08.2023 00:49

Re: about pywin32

Post by SamC »

main Alexey wrote: 09.01.2024 08:34 markdown cannot be used. forum uses BBCode as I know.

pywin32 plugin is outdated, no one used it for ages. can you update it for Py3.8 (then test it) and send me the .zip?
support(at)uvviewsoft.com
I do some test, it seems the installed pywin32 is with multi packages and also with a pywin32.pth file on the /site-packages folder, the context is below. I copy these all in cuda's py folder.
The import is with error that pywintypes.py can't be founld which is in the win32\lib folder.
I suppose maybe cuda didn't read the *.pth file, so the pywintypes.py is not found because not directly in the /py folder? Then the dependence is wrong?
# .pth file for the PyWin32 extensions
win32
win32\lib
Pythonwin
# This breaks any software involving a feedback loop involving PATH and Python
# One example of such software is the Anaconda Distribition's conda package
# manager, so we do not do it. We fixed this in a slightly better way anyway.
# import pywin32_bootstrap
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Re: about pywin32

Post by main Alexey »

yes, Cud don't read .pth files at all. it needs all modules in the 'sys.path' folders. and win32\lib is not in 'sys.path'.
maybe you can move files from win32\lib to upper dir?
SamC
Posts: 208
Joined: 12.08.2023 00:49

Re: about pywin32

Post by SamC »

main Alexey wrote: 09.01.2024 10:03 yes, Cud don't read .pth files at all. it needs all modules in the 'sys.path' folders. and win32\lib is not in 'sys.path'.
maybe you can move files from win32\lib to upper dir?
May I add some folder in sys.path of cuda?
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Re: about pywin32

Post by main Alexey »

some plugins modify 'sys.path' when they have COMPLEX modules to import.
main Alexey
Posts: 2323
Joined: 25.08.2021 18:15

Re: about pywin32

Post by main Alexey »

e.g. LSP plugin

Code: Select all

import sys
_plugin_dir = os.path.dirname(os.path.realpath(__file__))
#sys.path.append(os.path.join(_plugin_dir, 'lsp_modules'))
# instead of append use insert
sys.path.insert(0, os.path.join(_plugin_dir, 'lsp_modules'))   
Post Reply