我想根据this github code做点什么。
from progressbar import Progressbar, Fraction
ImportError: cannot import name 'Fraction'
我使用ipython 2或3
答案 0 :(得分:0)
您链接到的Github回购包含一个文件progressbar.py
,这是progressbar
的古代(2006年代)版本。 progressbar.py
包含Fraction
类,而progressbar
模块则不包含progressbar.py
类。因此,您需要将代码更改为指向Standford NLP Github存储库中的04-06 19:25:11.688 23407-23423/com.example.ali.dynamodb E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.example.ali.dynamodb, PID: 23407
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'com.amazonaws.auth.AWSCredentials com.amazonaws.auth.AWSCredentialsProvider.getCredentials()' on a null object reference
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:3504)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.getItem(AmazonDynamoDBClient.java:929)
at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load(DynamoDBMapper.java:393)
at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load(DynamoDBMapper.java:466)
at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load(DynamoDBMapper.java:340)
at com.example.ali.dynamodb.MainActivity$BackT.doInBackground(MainActivity.java:172)
at com.example.ali.dynamodb.MainActivity$BackT.doInBackground(MainActivity.java:161)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
文件。