Python: Importing "Text" from typing package - python

I trying to import Textfrom typing by,
from typing import Text
I am getting the following error,
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name 'Text'
I am working on Python 3.5
Any advice?

This is a known problem with Python 3.5.0 and 3.5.1 - see https://github.com/python/mypy/issues/1838 and https://github.com/awslabs/aws-encryption-sdk-cli/issues/114.
As they say there, you can add try/catch blocks around the typing imports - or you can use an updated version of Python.

Related

Receiving a Traceback error while using gingerit in python

I have a startup code to use gingerit on python. Gingerit is by far the most enhanced and the best grammar tool available on python. When I try running the code I have, I started receiving a traceback error.I am currently using 3.7 and the code I used is present on the official gingerit documentation.
text = 'it is there problem'
parser = GingerIt()
parser.parse(text)
I expected to not have any errors on this but there was a traceback error.
Traceback (most recent call last):
File "C:/Users/sid071/Desktop/gingerit.py", line 1, in <module>
from gingerit.gingerit import GingerIt
File "C:/Users/sid071/Desktop\gingerit.py", line 1, in <module>
from gingerit.gingerit import GingerIt
ModuleNotFoundError: No module named 'gingerit.gingerit'; 'gingerit' is not a package
Your script is called gingerit, which is hiding the package you installed. Rename your script to something else.

Unable to import RocksDB module

I am fairly new to working with RocksDB. I have set up the environment for RocksDB following the link here, but when I run a sample Python script having import rocksdb it says:
Traceback (most recent call last):
File "`<string>`", line 1, in <module>
ModuleNotFoundError: No module named 'rocksdb'
Can anybody suggest a solution to this issue?

Paymentwall-Python 1.0.7 Import Error

Following the official Paymentwall documentation testing the API, I tried the code below to import the library (exactly the same code as in the doc example):
from paymentwall import *
Paymentwall.set_api_type(Paymentwall.API_GOODS)
......
But it throws the following import error:
Traceback (most recent call last):
File "/Users/username/project/app/paymentwall.py", line 1, in <module>
from paymentwall import *
File "/Users/username/project/app/paymentwall.py", line 4, in <module>
Paymentwall.set_api_type(Paymentwall.API_GOODS)
NameError: name 'Paymentwall' is not defined
I have paymentwall-python 1.0.7 and Python 3.5.4 in the same conda virtual environment.
Any ideas? They tech support is incredibly slow.
This seems to work:
>>> from paymentwall.base import *
>>> Paymentwall.set_api_type(Paymentwall.API_GOODS)
perhaps the project's structure has changed, but the docs haven't been kept up to date.

Module in list can't be imported

I know that this could be marked as a duplicate, but hear me out!
The questions like this one are horribly out of date and no longer apply to my needs!
I used help("Modules")to get a list of all installed modules.
The module I was looking for, "crypt" was in the list.
When I tried to import it in the shell and in a new file, I got the following error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import crypt
File "C:\Users\Work\AppData\Local\Programs\Python\Python35-32\lib\crypt.py", line 3, in <module>
import _crypt
ImportError: No module named '_crypt'
Note:
I did not call it with an underscore
It looks like you are trying to run it on Windows -- crypt is a Unix-only library.
https://docs.python.org/dev/library/crypt.html

Python Lifetimes Module Error

I was trying to load the Lifetimes Module on my Linux AMI server.
I installed it just fine and everything seemed to work with no error.
However when I went to use it I got the error below. (tried to do a few things that I thought would fix it but nothing has worked)
import lifetimes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lifetimes/__init__.py", line 1, in <module>
from .estimation import BetaGeoFitter, ParetoNBDFitter, GammaGammaFitter
File "lifetimes/estimation.py", line 2, in <module>
from collections import OrderedDict
ImportError: cannot import name OrderedDict
http://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux
This is what worked for me but I did have to re-install the modules that were on 2.6 into 2.7

Categories