Page 1 of 1

ImportError: No module named pkgutil

Posted: Sun Sep 19, 2021 10:22 am
by yozayozo
Having added selenium library for a custom py script inside renpy, the compile on game start causes the following error:
While running game code:
File "game/apo.rpy", line 1, in script
init python:
File "game/apo.rpy", line 1, in script
init python:
File "game/apo.rpy", line 2, in <module>
from selenium import webdriver
ImportError: No module named pkgutil

If Its removed along with its usecases, the game starts normally. Therefore it is the cause of the error.
I have installed other libraries via pip directly inside the game/python-packages. requests and selenium are installed there.

I have searched other posts and saw from Tom that pkgutil should be installed by default or something along those lines.
Has anyone had a similar case, perhaps some solutions?

Additonal info: "apo.rpy" is just a file containing a py script that the game needs. Nothing else. This is the import of the libraries there:

Code: Select all

init python:
    from selenium import webdriver
    import time

Full traceback here:

Code: Select all

- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/bootstrap.py", line 326, in bootstrap
    renpy.main.main()
  File "renpy/main.py", line 515, in main
    renpy.game.context().run(node)
  File "game/apo.rpy", line 1, in script
    init python:
  File "game/apo.rpy", line 1, in script
    init python:
  File "renpy/ast.py", line 923, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 2235, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/apo.rpy", line 2, in <module>
    from selenium import webdriver
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/__init__.py", line 18, in <module>
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/firefox/webdriver.py", line 29, in <module>
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/remote/webdriver.py", line 26, in <module>
  File "renpy/loader.py", line 985, in load_module
    exec(code, mod.__dict__)
  File "python-packages/selenium/webdriver/remote/webelement.py", line 21, in <module>
ImportError: No module named pkgutil

Windows-10-10.0.19041
Ren'Py 7.4.8.1895
test_ac 1.0
Sun Sep 19 16:12:15 2021

Re: ImportError: No module named pkgutil

Posted: Sun Sep 19, 2021 3:55 pm
by PyTom
I wouldn't expect arbitrary third party modules to work with Ren'Py. Please make sure the packages you use support Ren'Py before you try to import them.

Re: ImportError: No module named pkgutil

Posted: Tue Sep 21, 2021 8:40 am
by yozayozo
How does one check if a package is supported by Ren'Py?

Re: ImportError: No module named pkgutil

Posted: Tue Sep 21, 2021 12:25 pm
by rayminator
yozayozo wrote: Tue Sep 21, 2021 8:40 am How does one check if a package is supported by Ren'Py?
contact them and ask them
https://www.selenium.dev/support/