library importing issues in pycharm - python

I'm doing a project on opencv python which is based on downloaded source code from the internet. When I run the code, this error occurs
C:\Users\Udara\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/Udara/Desktop/7777/people-counting-opencv/people_counter.py
Traceback (most recent call last):
File "C:/Users/Udara/Desktop/7777/people-counting-opencv/people_counter.py", line 13, in <module>
from pyimagesearch.centroidtracker import CentroidTracker
File "C:\Users\Udara\Desktop\7777\people-counting-opencv\pyimagesearch\centroidtracker.py", line 5, in <module>
import ordereddict
File "C:\Users\Udara\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ordereddict.py", line 23, in <module>
from UserDict import DictMixin
ModuleNotFoundError: No module named 'UserDict'

Related

ModuleNotFoundError: No module named 'winreg'

I have been trying to use photoshop-python-api but I keep getting this error.
Traceback (most recent call last):
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/api.py", line 2, in <module>
import photoshop.api as ps
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/__init__.py", line 1, in <module>
from photoshop.session import Session
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/session.py", line 31, in <module>
from photoshop.api import (
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/api/__init__.py", line 4, in <module>
from .action_descriptor import ActionDescriptor
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/api/action_descriptor.py", line 12, in <module>
from ._core import Photoshop
File "/Users/yash.sinha/PycharmProjects/PhotoshopPythonAPI/venv/lib/python3.8/site-packages/photoshop/api/_core.py", line 6, in <module>
import winreg
ModuleNotFoundError: No module named 'winreg'
I did my research on winreg and I found out that it is a Windows Register. Am I getting this error because I am using a Mac? I have python 3.8.2 on my system.
Help.

Python toolkit mb_protocol module not found error

I just have installed wxPython and python toolkit 18.08 in Ubuntu 20.04.But,while runnimg from command line python PTK.pyw, I got an error as below
> Traceback (most recent call last):
File "PTK.pyw", line 10, in <module>
import ptk_lib.app as app
File "/home/jobayer/下载/PythonToolkit-18.08/ptk_lib/app.py", line 17, in <module>
from ptk_lib.message_bus.mb_node import MBLocalNode
File "/home/jobayer/下载/PythonToolkit-18.08/ptk_lib/message_bus/mb_node.py", line 14, in <module>
import mb_protocol
ModuleNotFoundError: No module named 'mb_protocol'
I did not find mb_protocol module any where.Where can I find this module?

ImportError: No module named forms.form when using pyrobot library

I'm trying the solution for this issue here: Access and handle chrome extension popup using selenium webdriver
I'm getting an error when trying to import pyrobot and could not find any solution as to why I'm seeing this import error.
Traceback (most recent call last):
File "jungle.py", line 11, in <module>
from pyrobot import Robot
ImportError: cannot import name Robot
Chads-MacBook-Pro:amazon chad$ python jungle.py
Traceback (most recent call last):
File "jungle.py", line 11, in <module>
from pyrobot import Robot
File "/Users/chad/anaconda2/lib/python2.7/site-packages/pyrobot/__init__.py", line 3, in <module>
from .browser import RoboBrowser
File "/Users/chad/anaconda2/lib/python2.7/site-packages/pyrobot/browser.py", line 12, in <module>
from .forms.form import Form
ImportError: No module named forms.form

Can't import module ANTLR MyGrammarLexer and MyGrammarParser

I'm trying to start with ANTLR . When I import module antlr it's working just fine , but if I try to import MyGrammarLexer and MyGrammarParser , it's shows that MyGrammarLexer and Parser aren't in lib. I Using PyCharm , I installed ANTLR with : pip3 install antlr4-python3-runtime my code is :
import sys
from antlr4 import *
import MyGrammarLexer
import MyGrammarParser
def main(argv):
input = FileStream(argv[1])
lexer = MyGrammarLexer(input)
stream = CommonTokenStream(lexer)
parser = MyGrammarParser(stream)
tree = parser.startRule()
if __name__ == '__main__':
main(sys.argv)
Maybe whom know why i can't import MyGrammarLexer and MyGrammarParser?
Please suggest!
Tackback:
/usr/bin/python3.6 /home/andrejka/PycharmProjects/Parser/parser.py
Traceback (most recent call last):
File "/home/andrejka/PycharmProjects/Parser/parser.py", line 2, in <module>
from antlr4 import *
File "/usr/lib/python3/dist-packages/antlr4/__init__.py", line 5, in <module>
from antlr4.BufferedTokenStream import TokenStream
File "/usr/lib/python3/dist-packages/antlr4/BufferedTokenStream.py", line 19, in <module>
from antlr4.error.Errors import IllegalStateException
File "/usr/lib/python3/dist-packages/antlr4/error/Errors.py", line 5, in <module>
from antlr4.atn.Transition import PredicateTransition
File "/usr/lib/python3/dist-packages/antlr4/atn/Transition.py", line 19, in <module>
from __builtin__ import unicode
ModuleNotFoundError: No module named '__builtin__'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/home/andrejka/PycharmProjects/Parser/parser.py", line 2, in <module>
from antlr4 import *
File "/usr/lib/python3/dist-packages/antlr4/__init__.py", line 5, in <module>
from antlr4.BufferedTokenStream import TokenStream
File "/usr/lib/python3/dist-packages/antlr4/BufferedTokenStream.py", line 19, in <module>
from antlr4.error.Errors import IllegalStateException
File "/usr/lib/python3/dist-packages/antlr4/error/Errors.py", line 5, in <module>
from antlr4.atn.Transition import PredicateTransition
File "/usr/lib/python3/dist-packages/antlr4/atn/Transition.py", line 19, in <module>
from __builtin__ import unicode
ModuleNotFoundError: No module named '__builtin__'
I ran into this problem recently when getting the same error using the pddlpy python library. I was able to fix it by doing the following:
pip3 install antlr4-python3-runtime==4.9
The version 4.9 at the end is very important.
I found out that content of the package:
https://pypi.python.org/packages/0b/6b/30c5b84d203b62e1412d14622e3bae6273399d79d20f3a24c8145213f610/antlr4-python3-runtime-4.7.tar.gz#md5=190245a0fb4abf43568489a4b6e33aba
is different from the package installed by pip3.
I have replaced content of:
~/anaconda3/envs/py3/lib/python3.6/site-packages/antlr4
with content from the package I have downloaded and extracted manually:
~/Downloads/antlr4-python3-runtime-4.7/src/antlr4
It seems to be working now - in particular the following error:
ModuleNotFoundError: No module named '__builtin__'
does not occur.
After posting your traceback I can see the error is:
ModuleNotFoundError: No module named '__builtin__'
That means the package you try to import is using python2 syntax, but you're using python3.
You should use python2 if you need to run this package, but keep in mind that you probably want to search for a different one if this is a new project.
More about why it's not working here
EDIT
They released a package with python3 support, but it seems you installed/used something different. You should verify it.

xlwings - import error

Python 3.5 On Mac OS 10.12.2
When importing xlwings module i get a:
traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import xlwings
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xlwings/__init__.py", line 24, in <module>
from . import _xlmac as xlplatform
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xlwings/_xlmac.py", line 10, in <module>
import aem
ImportError: No module named 'aem'
I have appscript installed already.
Any idea what i am missing here please?

Categories

Resources