I tried to reinstall and reinstall three times, I tried to pip3 install --upgrade as well, simply no method I tried didn't worked. When I try to import twython or python twitter, I get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/Documents/Project Lib/python-twitter/twitter/__init__.py", line 56, in <module>
from .api import Api # noqa
File "/home/user/Document/Project Lib/python-twitter/twitter/api.py", line 29, in <module>
from requests_oauthlib import OAuth1
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/__init__.py", line 3, in <module>
from .oauth2_auth import OAuth2
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/oauth2_auth.py", line 3, in <module>
from oauthlib.oauth2 import is_secure_transport
ImportError: cannot import name 'is_secure_transport'
ps: This only happens on Python3, on Python2x all works fine.
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
I installed dhooks on Windows with the command:
pip install dhooks
but when it is executed it shows this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Webhook'
THIS IS MY CODE BELOW:
from dhooks import Webhook, Embed
hook = Webhook('https://discord.com/api/webhooks/22892770896038952/ao--vUV18I_DiZCmM50SifYeGpH-sC3AYKuqtVnEE')
embed = Embed(
description='This is the **description** of the embed! :smiley:',
color=0x5CDBF0,
timestamp='now' # sets the timestamp to current time
)
image1 = 'https://i.imgur.com/rdm3W9t.png'
image2 = 'https://i.imgur.com/f1LOr4q.png'
embed.set_author(name='Author Goes Here', icon_url=image1)
embed.add_field(name='Test Field', value='Value of the field :open_mouth:')
embed.add_field(name='Another Field', value='1234 :smile:')
embed.set_footer(text='Here is my footer text', icon_url=image1)
embed.set_thumbnail(image1)
embed.set_image(image2)
hook.send(embed=embed)
---------------------------------------------
**when I execute it gives the above error...**
> python bot.py
```Traceback (most recent call last):
File "C:\Users\user52\Desktop\bot\bot.py", line 1, in <module>
from dhooks import Webhook, Embed
File "C:\Python32\lib\site-packages\dhooks\__init__.py", line 1, in <module>
from .client import Webhook
File "C:\Python32\lib\site-packages\dhooks\client.py", line 3, in <module>
import aiohttp
File "C:\Python32\lib\site-packages\aiohttp\__init__.py", line 6, in <module>
from .client import (
File "C:\Python32\lib\site-packages\aiohttp\client.py", line 3, in <module>
import asyncio
File "C:\Python32\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\Python32\lib\asyncio\base_events.py", line 39, in <module>
from . import coroutines
File "C:\Python32\lib\asyncio\coroutines.py", line 5, in <module>
import inspect
File "C:\Python32\lib\inspect.py", line 36, in <module>
import bot
File "C:\Users\user52\Desktop\bot\bot.py", line 1, in <module>
from dhooks import Webhook, Embed
ImportError: cannot import name 'Webhook' from partially initialized module 'dhooks' (most likely due to a circular import) (C:\Python32\lib\site-packages\dhooks\__init__.py)```
Wondering someone will help.
pip install Webhook
Install that first and then the module you want
If the above doesn't work ,use
pip install webhooks
In my Python script I need gssapi as authentication mechanism when applying requests package.
It came to my attention that package requests_gssapi seems promising for my purpose.
After "pip install requests_gssapi" and import it I got this:
>>> from requests_gssapi import HTTPSPNEGOAuth
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\opt\Python36\lib\site-packages\requests_gssapi\__init__.py", line 17, in <module>
from .gssapi_ import HTTPSPNEGOAuth, REQUIRED, OPTIONAL, DISABLED # noqa
File "C:\opt\Python36\lib\site-packages\requests_gssapi\gssapi_.py", line 6, in <module>
import gssapi
File "C:\opt\Python36\lib\site-packages\gssapi\__init__.py", line 29, in <module>
from gssapi.raw.types import NameType, RequirementFlag, AddressType # noqa
File "C:\opt\Python36\lib\site-packages\gssapi\raw\__init__.py", line 50, in <module>
from gssapi.raw.creds import * # noqa
ImportError: DLL load failed: The specified module could not be found.
To me it seemed that extra package needs to be installed, but how?
Please help, thanks
I've installed BSON library to convert strings to MongoDB ObjectIds, but when I try using the library, this comes up:
Traceback (most recent call last):
File "search.py", line 7, in <module>
from pymongo.mongo_client import MongoClient
File "/home/user/anaconda3/lib/python3.6/site-packages/pymongo/__init__.py", line 90, in <module>
from pymongo.common import (MIN_SUPPORTED_WIRE_VERSION,
File "/home/user/anaconda3/lib/python3.6/site-packages/pymongo/common.py", line 21, in <module>
from pymongo.auth import MECHANISMS
File "/home/user/anaconda3/lib/python3.6/site-packages/pymongo/auth.py", line 33, in <module>
from bson.binary import Binary
File "/home/user/anaconda3/lib/python3.6/site-packages/bson/binary.py", line 21, in <module>
from bson.py3compat import PY3, binary_type
ImportError: cannot import name 'binary_type'
Also pip installs py3compat, but there's no 'binary_type' in there.
Any idea how to fix this?
I saw this error and got it fixed by installing the newest version of pymongo.
(at the time of writing)
pip install pymongo==3.5.1
I am trying to run this program but I am receiving this error:
python questions_app.py
Traceback (most recent call last):
File "questions_app.py", line 8, in <module>
from filter_daemon import *
File "/home/mona/danac/queshuns/filter_daemon.py", line 5, in <module>
from twython import TwythonStreamer
File "/usr/local/lib/python2.7/dist-packages/twython/__init__.py", line 23, in <module>
from .api import Twython
File "/usr/local/lib/python2.7/dist-packages/twython/api.py", line 14, in <module>
from requests_oauthlib import OAuth1, OAuth2
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/__init__.py", line 3, in <module>
from .oauth2_auth import OAuth2
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth2_auth.py", line 2, in <module>
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError
ImportError: cannot import name WebApplicationClient
What are some possible options to solve it?
I am using Ubuntu 13.04 and Python 2.7.
It seems like you do not have oauthlib.
pip install oauthlib