Getting Error even after installing Pyppeteer in Windows - python

Even after installing pyppeteer in windows using the following commands
pip install pyppeteer
pip install pipenv
pipenv shell
pipenv install pyppeteer
I am still getting this error while executing this command
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
from pyppeteer import launch
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyppeteer\__init__.py", line 30, in <module>
from pyppeteer.launcher import connect, executablePath, launch, defaultArgs # noqa: E402; noqa: E402
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyppeteer\launcher.py", line 26, in <module>
from pyppeteer.browser import Browser
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyppeteer\browser.py", line 11, in <module>
from pyee import EventEmitter
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyee\__init__.py", line 73, in <module>
from pyee._trio import TrioEventEmitter # noqa
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyee\_trio.py", line 4, in <module>
import trio
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\trio\__init__.py", line 18, in <module>
from ._core import (
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\trio\_core\__init__.py", line 9, in <module>
from ._exceptions import (
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\trio\_core\_exceptions.py", line 3, in <module>
from trio._util import NoPublicConstructor
ValueError: source code string cannot contain null bytes
Python version used: Python 3.10.6
pyppeteer version installed 1.0.2

Related

when importing web3 in python getting error

I am trying to execute the "import web3" statement in python console and getting the following error.
EDIT: I am using Python 3.9.0a1 and pip 21.3.1.
I have tried doing it both in VSCode terminal and windows command prompt.
>>> import web3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\__init__.py", line 9, in <module>
from web3.main import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\main.py", line 87, in <module>
from web3.manager import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\manager.py", line 47, in <module>
from web3.providers import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\providers\__init__.py", line 8, in <module>
from .rpc import ( # noqa: F401,
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\providers\rpc.py", line 21, in <module>
from web3._utils.request import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\web3\_utils\request.py", line 6, in <module>
from aiohttp import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\__init__.py", line 6, in <module>
from .client import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\client.py", line 35, in <module>
from . import hdrs, http, payload
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\http.py", line 7, in <module>
from .http_parser import (
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\http_parser.py", line 15, in <module>
from .helpers import NO_EXTENSIONS, BaseTimerContext
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\helpers.py", line 48, in <module>
from typing_extensions import Protocol
File "C:\Users\f1cmpica-1\AppData\Local\Programs\Python\Python39\lib\site-packages\typing_extensions.py", line 2142, in <module>
def TypeAlias(self, parameters):
TypeError: __init__() missing 1 required positional argument: 'doc'
You mentioned no version numbers.
https://stackoverflow.com/help/minimal-reproducible-example
I installed these from conda-forge, with interpreter 3.9.7 on MacOS 12.0.1:
typing-extensions 4.0.1
web3 5.26.0
And then import web3 works Just Fine.

TypeError from importing discord.py

I just installed the discord.py rewrite branch, but attempting to use import discord or from discord.ext import commands simply results in a TypeError.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/discord/__init__.py", line 20, in <module>
from .client import Client, AppInfo
File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 30, in <module>
from .guild import Guild
File "/usr/local/lib/python3.6/site-packages/discord/guild.py", line 39, in <module>
from .channel import *
File "/usr/local/lib/python3.6/site-packages/discord/channel.py", line 31, in <module>
from .webhook import Webhook
File "/usr/local/lib/python3.6/site-packages/discord/webhook.py", line 27, in <module>
import aiohttp
File "/usr/local/lib/python3.6/site-packages/aiohttp/__init__.py", line 6, in <module>
from .client import * # noqa
File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 15, in <module>
from . import connector as connector_mod
File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 17, in <module>
from .client_proto import ResponseHandler
File "/usr/local/lib/python3.6/site-packages/aiohttp/client_proto.py", line 6, in <module>
from .http import HttpResponseParser, StreamWriter
File "/usr/local/lib/python3.6/site-packages/aiohttp/http.py", line 8, in <module>
from .http_parser import (HttpParser, HttpRequestParser, HttpResponseParser,
File "/usr/local/lib/python3.6/site-packages/aiohttp/http_parser.py", line 15, in <module>
from .http_writer import HttpVersion, HttpVersion10
File "/usr/local/lib/python3.6/site-packages/aiohttp/http_writer.py", line 304, in <module>
class URL(yarl.URL):
File "/usr/local/lib/python3.6/site-packages/yarl/__init__.py", line 232, in __init_subclass__
"is forbidden".format(cls))
TypeError: Inheritance a class <class 'aiohttp.http_writer.URL'> from URL is forbidden
Although the error is technically from yarl rather than from discord.py itself, the error only occurs upon trying to import the modules.
I've already tried reinstalling python as well as the discord.py rewrite branch, and if it makes any difference am running on a RPi 3 B+
Your aiohttp package might be out of date.
Try
pip install --upgrade aiohttp
I tried to install discord.py on my python 3.7 and it didn't work.
I had to install python 3.6.6 to make it work, maybe you are using python 3.7, if so you should try rolling back to python 3.6.6

Pip not working in my system,

I am getting the following error while using pip command, in anaconda.
C:\Users\name>pip install xmlschema
Traceback (most recent call last):
File "C:\ANACONDA2\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 558, in load_entry_point
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2682, in load_entry_point
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2355, in load
File "C:\ANACONDA2\lib\site-packages\setuptools-18.4-py2.7.egg\pkg_resources\__init__.py", line 2361, in resolve
File "c:\anaconda2\lib\site-packages\pip\__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "c:\anaconda2\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
File "c:\anaconda2\lib\site-packages\pip\index.py", line 33, in <module>
from pip._vendor import html5lib, requests, six
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\__init__.py", line 19, in <module>
from .serializer import serialize
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\serializer\__init__.py", line 5, in <module>
from .htmlserializer import HTMLSerializer
File "c:\anaconda2\lib\site-packages\pip\_vendor\html5lib\serializer\htmlserializer.py", line 11, in <module>
from .. import utils
ImportError: cannot import name utils
I am having utils package, but still throwing ImportError: cannot import name utils
On windows there is no sudo command. You have to run the command line as administrator and run the pip commands from above without sudo.
you can try this commands to fix it:
pip uninstall requests
pip install --upgrade requests
if you have trouble about to execute pip command on windows, check this link

Tweepy installation?

I tried to install tweepy by using different methods such as
pip install tweepy
sudo pip install tweepy
Lastly, i downloaded zip package from the github and used the command to install:
python setup.py install
Apparently, installation was completed successfully, however when i run a simple program which contains only one line such as import tweepy, the following error is thrown:
Traceback (most recent call last):
File "tweepytest.py", line 1, in <module>
import tweepy
File "build/bdist.macosx-10.6-intel/egg/tweepy/__init__.py", line 14, in <module>
File "build/bdist.macosx-10.6-intel/egg/tweepy/api.py", line 12, in <module>
File "build/bdist.macosx-10.6-intel/egg/tweepy/binder.py", line 11, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 33, in <module>
from .packages.ssl_match_hostname import CertificateError
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/packages/__init__.py", line 3, in <module>
from . import ssl_match_hostname
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py", line 3, in <module>
from ssl import CertificateError, match_hostname
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 90, in <module>
import textwrap
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/textwrap.py", line 40, in <module>
class TextWrapper:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/textwrap.py", line 82, in TextWrapper
whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
AttributeError: 'module' object has no attribute 'maketrans'
You should try
pip3 install tweepy
or...
pip install git+https://github.com/tweepy/tweepy.git
Based on what you are saying. I assume you are using python3. You can have a work-around to make this work by replacing this File
File
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/textwrap.py on line 82
From
whitespace_trans = string.maketrans(
to
whitespace_trans = str.maketrans(
This would make the code compile for python3 docs.
There is another installation option you could try that clones a repo from GitHub:
git clone https://github.com/tweepy/tweepy.git
cd tweepy
pip install .

Python error while installing using homebrew

Hi I installed python using "homebrew install python".
A script which was already running started throwing below error.
Traceback (most recent call last):
File "TestConnection.py", line 1, in <module>
from TextUpdater import TextUpdater
File "/Users/gepaul/code/external-tools/tools/Scripts/TextUpdater.py", line 1, in <module>
from GSHelper import GSHelper
File "/Users/gepaul/code/external-tools/tools/Scripts/GSHelper.py", line 2, in <module>
import gspread
File "/Library/Python/2.7/site-packages/gspread/__init__.py", line 21, in <module>
from .client import Client, login, authorize
File "/Library/Python/2.7/site-packages/gspread/client.py", line 19, in <module>
from .httpsession import HTTPSession, HTTPError
File "/Library/Python/2.7/site-packages/gspread/httpsession.py", line 16, in <module>
from http import client
ImportError: cannot import name client
Any Idea why this happened?
Python version is Python 2.7.6

Categories