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.
Related
I've tried running a program which imports the Pandapower library, and I get the Error:
NameError: name 'TextPath' is not defined
I installed Pandapower via pip install normally, and it works good, but it seems to have Problems with "pandapower.plotting.collections" and the class "class CustomTextPath(TextPath):"
Minimal Code:
import pandapower as pp
import pandapower.plotting as plot
TracebacK:
Traceback (most recent call last): File "-\Test.py", line 2, in <module> import pandapower.plotting as plot File "-\Python\Python310\lib\site-packages\pandapower\plotting\__init__.py", line 1, in <module> from pandapower.plotting.collections import * File "-\Python\Python310\lib\site-packages\pandapower\plotting\collections.py", line 36, in <module> class CustomTextPath(TextPath): NameError: name 'TextPath' is not defined
This is a bug in pandapower. They depend on having matplotlib installed. The code catches its absence with a try/except but still tries to use the elements it would have imported. So, do a pip install matplotlib and you should be good.
I need to build a Bayesian Network using naive bayes with libpgm.
The BN structure is known, so I just need to import it as a GraphSkeleton object with libpgm.graphskeleton.
When I run the code, it gives me the following error:
Traceback (most recent call last):
File "C:\Users\X\Documents\Modelli Probabilistici\0-NEW\reteBayesiana1.py", line 3, in <module>
from libpgm.graphskeleton import GraphSkeleton
File "C:\Users\X\AppData\Local\Programs\Python\Python37-32\lib\site-packages\libpgm\graphskeleton.py", line 29, in <module>
from dictionary import Dictionary
<b>ModuleNotFoundError: No module named 'dictionary'</b>
I installed the library using "pip3 install libpgm" and I didn't get any errors during the installation.
Here is my Code:
import libpgm
from libpgm.graphskeleton import GraphSkeleton
skel = GraphSkeleton()
skel.load("skeleton.txt")
...
I checked my libraries folder and libpgm seems to be installed correctly, also there are both a 'graphskeleton.py' file and a 'dictionary.py' file and they both seem to have the objects needed (GraphSkeleton and Dictionary, which is required for 'graphskeleton.py')
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.
My background is Java/C++ and I'm very new to python. I'm trying to import pyodbc to my project which works alright if I do it via command line.
import odbc
However, when I try to do the same in pydev/eclipse, i get the following error which I cannot find a solution to. I suspect this may have something to do with Eclipse setup
Traceback (most recent call last):
File "C:\Users\a\workspace\TestPyProject\src\helloworld.py", line 2, in <module>
import pyodbc
File "C:\Users\a\AppData\Local\Continuum\Anaconda3\Lib\site-packages\sqlalchemy\dialects\mssql\pyodbc.py", line 105, in <module>
from .base import MSExecutionContext, MSDialect, VARBINARY
ImportError: attempted relative import with no known parent package
I'm really stuck here and any hints will be appreciated!
An incorrect library was imported into the External Libraries list of the project. After fixing it, the import is working.
I successfully installed JPype and Boilerpipe Python wrapper.
My JAVA_HOME path is correct (as far as I know).
I created a python file with the following code:
from boilerpipe.extract import Extractor
extractor = Extractor(extractor='ArticleExtractor', url='http://edition.cnn.com/2016/02/09/politics/new-hampshire-primary-highlights/')
extracted_text = extractor.getText()
print(extracted_text)
I am getting this error when I run python3 boiler_test.py
Traceback (most recent call last):
File "boiler_test.py", line 1, in <module>
from boilerpipe.extract import Extractor
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/boilerpipe/extract/__init__.py", line 2, in <module> import urllib2
ImportError: No module named 'urllib2'
How can I solve this?
Thank you.