Sublime Forum

Can't import win32com

#1

I created a plugin a long time ago for ST3 that imported win32com.

Now when I have updated to Build 4107 it no longer workes

Now when I do:
import win32com.client

I get the following error:
>>> import win32com.client
Traceback (most recent call last):
File “main”, line 1, in
File “C:\Users\palli\AppData\Roaming\Sublime Text
3\Packages\Pywin32\lib\x64\win32com_init_.py”, line 5, in
import win32api, sys, os
ImportError: Module use of python33.dll conflicts with this version of Python.

Anyone know what is going on or how to fix this?
Also, is there something else I can use instead of win32com?

0 Likes

#3

ST4’s console is py38 by default. If you want to do quick test in old py33,
image

0 Likes

#4

Interesting, looks like it workes on Py33. Now can I have my plugin use py33?

0 Likes

#5

it’s the default for plugins.

0 Likes

#6

Ok, so when I import in the py3.3 console it workes fine.
But when I try to import in my plugin I get the following:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\Lib\python38\sublime_plugin.py", line 312, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.8/importlib/__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 808, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\palli\AppData\Roaming\Sublime Text 3\Packages\User\OpenVisualStudio.py", line 1, in <module>
    import win32com.client
  File "C:\Users\palli\AppData\Roaming\Sublime Text 3\Packages\Pywin32\lib\x64\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: Module use of python33.dll conflicts with this version of Python.
0 Likes

#7

Ok, I think I figured it out:
My plugin depends on Pywin32.
It includes some library that I guess needs to be recompiled for the new python version, 3.8 I guess.

0 Likes

#8

Python files in the User directory run in py38, but any other folder in the Packages dir runs in py33. So, you can make a random folder name in the Packages/ directory and move your plugin over there.

0 Likes

#9

Worked like a charm, thank you so much you beautiful bastard

1 Like