Cannot get lexers.PythonLexer () from a Kivy application created using PyInstaller

I have a Python application that works very well, inside of which I am doing something like:

from pygments import lexers

then ...

testing = lexers.PythonLexer()

Just running the script works fine, and I get a new instance of PythonLexer. However ... when I create a folder to create the application using PyInstaller and then run it, this line crashes:

File "blah \ myfile", line 31, in __init__ AttributeError: the object 'module' does not have the attribute 'PythonLexer'

Any ideas? I think this is because pigments somehow create their runtime objects from some files that are not in my PyInstaller assembly folder, but I can’t figure out how to do this.

Kivy, , .

+4
3

, pygments.lexers PythonLexer.py. , :

from pygments.lexers.agile import PythonLexer
testing = PythonLexer()
+2

pyinstaller Kivy 'showcase.

, .

, \pygments\lexers\__init__.py, :

--- __init__old.py
+++ __init__.py
@@ -15,6 +15,7 @@
import fnmatch
from os.path import basename

+from pygments.lexers.agile import PythonLexer
from pygments.lexers._mapping import LEXERS
from pygments.modeline import get_filetype_from_buffer
0

Source: https://habr.com/ru/post/1541691/


All Articles