gaoyaqiu:git gaoyaqiu$ scrapy
Traceback (most recent call last):
File /usr/local/bin/scrapy, line 7, in <module>
from scrapy.cmdline import execute
File /Library/Python/2.7/site-packages/scrapy/cmdline.py, line 9, in <module>
from scrapy.crawler import CrawlerProcess
File /Library/Python/2.7/site-packages/scrapy/crawler.py, line 7, in <module>
from twisted.internet import reactor, defer
File /Library/Python/2.7/site-packages/twisted/internet/reactor.py, line 38, in <module>
from twisted.internet import default
File /Library/Python/2.7/site-packages/twisted/internet/default.py, line 56, in <module>
install = _getInstallFunction(platform)
File /Library/Python/2.7/site-packages/twisted/internet/default.py, line 50, in _getInstallFunction
from twisted.internet.selectreactor import install
File /Library/Python/2.7/site-packages/twisted/internet/selectreactor.py, line 18, in <module>
from twisted.internet import posixbase
File /Library/Python/2.7/site-packages/twisted/internet/posixbase.py, line 18, in <module>
from twisted.internet import error, udp, tcp
File /Library/Python/2.7/site-packages/twisted/internet/tcp.py, line 28, in <module>
from twisted.internet._newtls import (
File /Library/Python/2.7/site-packages/twisted/internet/_newtls.py, line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File /Library/Python/2.7/site-packages/twisted/protocols/tls.py, line 63, in <module>
from twisted.internet._sslverify import _setAcceptableProtocols
File /Library/Python/2.7/site-packages/twisted/internet/_sslverify.py, line 38, in <module>
TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
AttributeError: module object has no attribute OP_NO_TLSv1_1
I came across with same issue.
The following thread helped.
pip install Twisted==16.4.1
If you need sudo access then add it to your command.
https://github.com/scrapy/scrapy/issues/2473
actually it is solved by:
pip install pyopenssl --upgrade
from the link: scrapy: 'module' object has no attribute 'OP_SINGLE_ECDH_USE'
Related
I'm trying to use the TikTokPy but there is an error occurring in Greenlet module:
$ python quickstart.py
Traceback (most recent call last):
File "C:\Users\mngoc\tiktokpy\quickstart.py", line 2, in <module>
from tiktokpy import TikTokPy
File "C:/Users\mngoc\tiktokpy/tiktokpy/__init__.py", line 1, in <module>
from .bot import TikTokPy
File "C:/Users\mngoc\tiktokpy/tiktokpy/bot/__init__.py", line 15, in <module>
from tiktokpy.client import Client
File "C:/Users\mngoc\tiktokpy/tiktokpy/client/__init__.py", line 8, in <module>
from playwright.async_api import Browser, Page, Playwright, PlaywrightContextManager, Response
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/async_api/__init__.py", line 25, in <module>
import playwright.async_api._generated
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/async_api/_generated.py", line 25, in <module>
from playwright._impl._accessibility import Accessibility as AccessibilityImpl
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/_impl/_accessibility.py", line 17, in <module>
from playwright._impl._connection import Channel
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/_impl/_connection.py", line 23, in <module>
from greenlet import greenlet
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/greenlet/__init__.py", line 29, in <module>
from ._greenlet import _C_API # pylint:disable=no-name-in-module
ModuleNotFoundError: No module named 'greenlet._greenlet'
I've already installed Greenlet module, but I have no idea about ._greenlet, there isn't any answer for related question so I'm stuck.
You should install the module:
pip3 install greenlet
Whenever I run a command related to pip, or pip itself, it just returns an exception and it doesn't install anything
Here's the exception info:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/configuration.py", line 27, in <module>
from pip._internal.utils.misc import ensure_dir, enum
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 38, in <module>
from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_vendor/tenacity/__init__.py", line 522, in <module>
from pip._vendor.tenacity._asyncio import AsyncRetrying
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pip/_vendor/tenacity/_asyncio.py", line 19, in <module>
from asyncio import sleep
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296
future = tasks.async(future, loop=self)
I was running pip commands to install libraries on replit (because upm doesn't work well), but after uninstalling discord.py, it doesn't seem to work properly anymore
from my experience it is much better to use the pip module instead of the executable.
python3 -m pip install --upgrade pip # upgrade pip
python3 -m pip install replit # install the desired module
I've been trying to run a scrapy spider from a .bat file
when I run the .bat file which has this text:
#echo off
REM activate Python venv
CALL "D:\python\scrapy_projects\venv\Scripts\activate.bat"
CD "D:\python\scrapy_projects\digikalasellerdata\digikalasellerdata\spiders"
CALL "D:\python\scrapy_projects\venv\Scripts\python.exe" "D:\python\scrapy_projects\venv\Lib\site-packages\scrapy\cmdline.py" crawl my_deactivated -O kobs.csv
pause
I get this error:
Traceback (most recent call last):
File "D:\python\scrapy_projects\venv\Lib\site-packages\scrapy\cmdline.py", line 8, in <module>
import scrapy
File "D:\python\scrapy_projects\venv\lib\site-packages\scrapy\__init__.py", line 12, in <module>
from scrapy.spiders import Spider
File "D:\python\scrapy_projects\venv\lib\site-packages\scrapy\spiders\__init__.py", line 10, in <module>
from scrapy.http import Request
File "D:\python\scrapy_projects\venv\lib\site-packages\scrapy\http\__init__.py", line 8, in <module>
from scrapy.http.headers import Headers
File "D:\python\scrapy_projects\venv\lib\site-packages\scrapy\http\headers.py", line 3, in <module>
from scrapy.utils.python import to_unicode
File "D:\python\scrapy_projects\venv\lib\site-packages\scrapy\utils\python.py", line 16, in <module>
from scrapy.utils.decorators import deprecated
File "D:\python\scrapy_projects\venv\lib\site-packages\scrapy\utils\decorators.py", line 4, in <module>
from twisted.internet import defer, threads
File "D:\python\scrapy_projects\venv\lib\site-packages\twisted\internet\defer.py", line 44, in <module>
from twisted.internet.interfaces import IDelayedCall, IReactorTime
File "D:\python\scrapy_projects\venv\lib\site-packages\twisted\internet\interfaces.py", line 26, in <module>
from twisted.python.failure import Failure
File "D:\python\scrapy_projects\venv\lib\site-packages\twisted\python\failure.py", line 26, in <module>
from twisted.python import reflect
File "D:\python\scrapy_projects\venv\lib\site-packages\twisted\python\reflect.py", line 22, in <module>
from twisted.python.compat import nativeString
File "D:\python\scrapy_projects\venv\lib\site-packages\twisted\python\compat.py", line 35, in <module>
from http import cookiejar as cookielib
File "D:\python\scrapy_projects\venv\Lib\site-packages\scrapy\http\__init__.py", line 8, in <module>
from scrapy.http.headers import Headers
ImportError: cannot import name 'Headers' from partially initialized module 'scrapy.http.headers' (most likely due to a circular import) (D:\python\scrapy_projects\venv\lib\site-packages\scrapy\http\headers.py)
any solutions?
Thanks a lot
Instead of directly calling the Python file, use this:
python -m scrapy crawl my_deactivated -O kobs.csv
That's what you activated the virtual environment for.
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
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