简体   繁体   中英

Error using cx_freeze with a feedparser import: ModuleNotFoundError: No module named 'sgmllib'

I am trying to use cx_freeze to freeze an app that uses Feedparser. The app works perfectly if I launch it from the command line using python. However, when I try to freeze it using cx_freeze, I don't get an error until I try to launch the app. Then I get:

Traceback (most recent call last):
  File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 66, in run
    module.run()
  File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/Console.py", line 36, in run
    exec(code, m.__dict__)
  File "main.py", line 8, in <module>
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/__init__.py", line 28, in <module>
    from .api import parse
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/api.py", line 36, in <module>
    from .html import _BaseHTMLProcessor
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/html.py", line 31, in <module>
    from .sgml import *
  File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/sgml.py", line 30, in <module>
    import sgmllib
ModuleNotFoundError: No module named 'sgmllib'

I know sgmllib is no longer used in Python 3, but since I don't get this error when I launch it from the command line it doesn't seem to be a feedparser issue. Any thoughts?

The cx_Freeze developer helped me with this same issue on Github. Here's the thread.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM