I'm trying to compile some script with twisted and Queue.
pyinstaller sample.py --onefile # -*- coding: utf-8 -*-# from twisted import * import queue as Queue a = Queue.Queue() Unfortunately, produced file fails with ImportError: No module named queue.
3 Answers
Answers 1
I don't think this is a PyInstaller or Twisted related issue at all. The Queue module is part of the standard library, and the issue is how you're naming it. In Python 2, it's Queue with a capital letter, but in Python 3, it's renamed queue to follow the more standard naming convention where modules have lowercase names.
Your script seems like it's a port of Python 2 code to Python 3 (thus the as Queue part of the import), but you're running it with Python 2 still. That may fail in other more subtle ways than just the Queue import being wrong (e.g. its Unicode handling may be all wrong).
Answers 2
pip install twisted --upgrade fixed everything.
Answers 3
If you're using python 2, then queue is not part of its standard library. Try:
from collections import deque
0 comments:
Post a Comment