sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #58723
[Question #705833]: Import error from within python module
New question #705833 on SikuliX:
https://answers.launchpad.net/sikuli/+question/705833
I'm trying to use a python module within Sikuli IDE. I've added the site-packages path to sites.txt, as per the documentation. So the module is found.
But when the module tries to import other python modules (from the standard library), there's an error. I tried importing the dependent modules manually, and it works for BytesIO in the IO library, but not for zip_longest in the itertools library.
import io # mutagen requires the BytesIO module in the IO Library
from io import * # saw this in a previous answer from Raiman on importing modules
import mutagen # no error - the package is found
import itertools
from itertools import * # trying to pre-import zip_longest before the next line
from mutagen.wave import WAVE # this is where the error occurs
[error] script [ audio ] stopped with error in line 6
[error] ImportError ( cannot import name zip_longest )
[error] --- Traceback --- error source first
line: module ( function ) statement
11: _tags ( <module> ) from itertools import zip_longest
19: _file ( <module> ) from ._tags import ID3Tags, ID3Header, ID3SaveConfig
32: __init__ ( <module> ) from ._file import ID3, ID3FileType, delete, ID3v1SaveOptions
16: wave ( <module> ) from mutagen.id3 import ID3
6: main ( <module> ) from mutagen.wave import WAVE
[error] --- Traceback --- end --------------
Note, I've tried the code in the Python environment (command prompt) and it works. Do I need to point Sikuli to the python standard library?
--
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.