Selenium Python Ubuntu- Import http.client AttributeError - python

It's been days i'm fighting with this error.
My background is :
- Clean install of Lubuntu ( based on ubuntu 15 ) w/ just setuptools and selenium 2.50 installed
- A selenium python3 script.
I tried running this script w/ an other machine ( lubuntu based on ubuntu 14 ) and it runs, but with the new machine, all the scripts doesn't work.
I looked up on the big internet but i couldn't find an answer.
I have the following error :
Traceback (most recent call last):
File "tesst.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/__init__.py", line 18, in <module>
from selenium import selenium
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/selenium.py", line 23, in <module>
import http.client as http_client
File "/usr/lib/python3.4/http/client.py", line 69, in <module>
import email.parser
File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
from email.feedpaarser import FeedParser, BytesFeedParser
File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.4/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.4/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/usr/lib/python3.4/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/firefox/webdriver.py", line 20, in <module>
import http.client as http_client
AttributeError: 'module' object has no attribute 'client'
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 21, in <module>
from urllib.request import urlopen
File "/usr/lib/python3.4/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib/python3.4/http/client.py", line 69, in <module>
import email.parser
File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.4/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.4/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/usr/lib/python3.4/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/__init__.py", line 18, in <module>
from selenium import selenium
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/selenium.py", line 23, in <module>
import http.client as http_client
AttributeError: 'module' object has no attribute 'client'
Original exception was:
Traceback (most recent call last):
File "tesst.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/__init__.py", line 18, in <module>
from selenium import selenium
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/selenium.py", line 23, in <module>
import http.client as http_client
File "/usr/lib/python3.4/http/client.py", line 69, in <module>
import email.parser
File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.4/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.4/email/utils.py", line 33, in <module>
from email._parseaddr import quote
File "/usr/lib/python3.4/email/_parseaddr.py", line 16, in <module>
import time, calendar
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in <module>
from selenium import webdriver
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox
File "/usr/local/lib/python3.4/dist-packages/selenium-2.50.0-py3.4.egg/selenium/webdriver/firefox/webdriver.py", line 20, in <module>
import http.client as http_client
I looked a lot before coming here but i'm kinda lost right now. Can someone please help, i'll be very greatful.
Thanks !!
Edit :
Hey, i already try all of that, but it's not fixing the issue. I don't have duplicate selenium, i just install
sudo python3 setup.py install in selenium dir. Also i don't have a script called http.py, so when i do import http http.__file__ it gives me /usr/lib/python3.4/http/__init__.py

Ok, let's face it, i knew it, the answer was just in front of my eyes. S**t !!
This
File "/home/XXXX/Scripts/XXXX/calendar.py", line 1, in
I had a script name calendar.py as a module... So changing the name made the job.
Sorry guys, and thank you

Related

Cant install pip on mac? Using VS code

whenever i use the terminal and type pip3 install requests this is what happens:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3", line 11, in <module>
sys.exit(main())
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/__init__.py", line 13, in main
from pip._internal.utils.entrypoints import _wrapper
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/utils/entrypoints.py", line 4, in <module>
from pip._internal.cli.main import main
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/configuration.py", line 21, in <module>
from pip._internal.exceptions import (
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_internal/exceptions.py", line 8, in <module>
from pip._vendor.requests.models import Request, Response
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/__init__.py", line 123, in <module>
from . import utils
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/utils.py", line 27, in <module>
from ._internal_utils import to_native_string
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "/Users/hawawague/Library/Python/3.7/lib/python/site-packages/pip/_vendor/requests/compat.py", line 63, in <module>
from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment
ImportError: cannot import name 'parse_http_list' from 'urllib.request' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py)
Is there something I did wrong?
Try running pip3 install --upgrade pip
then try again with pip3 install requests

python TypeError: 'type' object is not iterable error

I am getting an error message when I try to run a python script, the python script I am attempting to run is https://raw.githubusercontent.com/orangetw/awesome-jenkins-rce-2019/master/exp.py I don't think that this is an issue with the script as I am able to run this on my host OS (having run the script in as OS)
Traceback (most recent call last):
File "exp.py", line 7, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 84, in <module>
from urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/home/kali/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/home/kali/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/base.py", line 18, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 26, in <module>
from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 16, in <module>
from cryptography.x509.name import Name
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <module>
_ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type}
TypeError: 'type' object is not iterable
line 7 is
import requests
Help appreciated

No Calendar package is imported

When trying to run the following script:
import matplotlib as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
I exeperience the following error:
C:\Users\raja\PycharmProjects\Project_test\venv\Scripts\python.exe C:/Users/raja/.PyCharmCE2018.2/config/scratches/testing.py
Traceback (most recent call last):
File "C:/Users/raja/.PyCharmCE2018.2/config/scratches/testing.py", line 1, in <module>
import matplotlib as plt
File "C:\Users\raja\PycharmProjects\Project_test\venv\lib\site-packages\matplotlib\__init__.py", line 136, in <module>
import urllib.request
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 88, in <module>
import http.client
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\email\feedparser.py", line 27, in <module>
from email._policybase import compat32
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\email\_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\email\utils.py", line 33, in <module>
from email._parseaddr import quote
File "C:\Users\raja\AppData\Local\Programs\Python\Python37\lib\email\_parseaddr.py", line 16, in <module>
import time, calendar
File "C:\Users\raja\.PyCharmCE2018.2\config\scratches\calendar.py", line 7, in <module>
import tkcalendar
ModuleNotFoundError: No module named 'tkcalendar'
Why? Does anybody know how to solve this issue?
I have fixed it. there was a different python program I named it as Calendar.py :(. I have deleted that file from "config/scratches/" and it has fixed the issue.
Also I have deleted the two versions of Tkcalendar installed

In using flask with soundcloud library , Why 'no module named moves'?

Trying to make use of the python-soundcloud package, imported it to implement its server side authentication for my app:
$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 5, in <module>
from mic import app, db
File "/Users/harryagbo/Documents/Portfolio/Mojok/mic.py", line 3, in <module>
import soundcloud
File "/usr/local/lib/python2.7/site-packages/soundcloud/__init__.py", line 8, in <module>
from soundcloud.client import Client
File "/usr/local/lib/python2.7/site-packages/soundcloud/client.py", line 8, in <module>
from soundcloud.request import make_request
File "/usr/local/lib/python2.7/site-packages/soundcloud/request.py", line 6, in <module>
import requests
File "/usr/local/lib/python2.7/site-packages/requests/__init__.py", line 52, in <module>
from . import utils
File "/usr/local/lib/python2.7/site-packages/requests/utils.py", line 22, in <module>
from .compat import parse_http_list as _parse_list_header
File "/usr/local/lib/python2.7/site-packages/requests/compat.py", line 95, in <module>
from .packages import chardet
File "/usr/local/lib/python2.7/site-packages/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 44, in <module>
from .util import get_host, is_connection_dropped
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/__init__.py", line 5, in <module>
from .response import is_fp_closed
File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/response.py", line 2, in <module>
from ..packages.six.moves import http_client as httplib
ImportError: No module named moves

Amazon Elastic Beanstalk CLI issues on linux: zlib error

I am trying to use elastic beanstalk cli on an amazon linux instance and I always get zlib module error. This probably is more to do with my linux/unix ignorance but please send any inputs you have.
$ eb init
Traceback (most recent call last):
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/eb", line 17, in <module>
from scli import core
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/scli/core .py", line 24, in <module>
from scli import command, cli_parse, config_file, prompt
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/scli/comm and.py", line 18, in <module>
from scli.operation_queue import OperationQueue
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/scli/oper ation_queue.py", line 19, in <module>
from scli.operation.base import OperationBase
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/scli/oper ation/base.py", line 21, in <module>
from lib.elasticbeanstalk import eb_utils
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/lib/elast icbeanstalk/eb_utils.py", line 22, in <module>
from scli import api_wrapper
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/scli/api_ wrapper.py", line 19, in <module>
from lib.elasticbeanstalk.servicecall import ElasticBeanstalkClient
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/lib/elast icbeanstalk/servicecall.py", line 23, in <module>
from lib.aws.webservice import AWSQueryClient, AWSSignature
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/lib/aws/w ebservice.py", line 26, in <module>
from . import requests
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/lib/aws/r equests/__init__.py", line 52, in <module>
from . import utils
File "/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.4.0/eb/linux/python3/lib/aws/r equests/utils.py", line 18, in <module>
import zlib
ImportError: No module named zlib

Categories

Resources