Closed Vicedivic closed 6 years ago
This is how texts.json looks:
[ { "author": "Victor", "title": "Lorem ipsum", "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." }, ]
with indentation, of course
Probably my fault. I will set up some unit tests to make sure I do not break stuff like this. Expect an upcoming bugfix.
Also thanks for the nice comments!
OK, just drop the dangling comma at the end of the dict, and it loads fine. I'll turn that backtrace into a nicely formatted error message.
I tried out your project, @cslarsen , and it worked very well. You have made a very good wpm measurement terminal app. One thing that didn't work for me is that when i try to make a custom text in a JSON file and load it with
wpm --load-json texts.json
, it gives me this error:Traceback (most recent call last): File "/usr/local/bin/wpm", line 4, in
import('pkg_resources').run_script('wpm==1.50.4', 'wpm')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 742, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 1674, in run_script
exec(script_code, namespace, namespace)
File "/Library/Python/2.7/site-packages/wpm-1.50.4-py2.7.egg/EGG-INFO/scripts/wpm", line 11, in
File "build/bdist.macosx-10.13-intel/egg/wpm/commandline.py", line 183, in main File "build/bdist.macosx-10.13-intel/egg/wpm/commandline.py", line 95, in load_json_quotes File "build/bdist.macosx-10.13-intel/egg/wpm/quotes.py", line 169, in load_json File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 290, in load **kw) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded
Is there something i have done wrong?