MicheleTobias / LiteratureMapper

A QGIS plugin to add geoJSON geometries to records in a Zotero library
GNU General Public License v2.0
28 stars 7 forks source link

Save to Zotero error #33

Closed edrouin closed 5 years ago

edrouin commented 5 years ago

I get this error when I click Save to zotero:

_2019-02-15T16:21:35 WARNING Traceback (most recent call last): File "C:/Users/droet1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LiteratureMapper\literature_mapper.py", line 248, in saveZotero item_json = json.load(urllib.request.urlopen(request_url)) File "C:\Mrnmicro\Usagers\droet1\MESDOC~1\PROGRA~1\QGIS\apps\Python37\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout) File "C:\Mrnmicro\Usagers\droet1\MESDOC~1\PROGRA~1\QGIS\apps\Python37\lib\urllib\request.py", line 531, in open response = meth(req, response) File "C:\Mrnmicro\Usagers\droet1\MESDOC~1\PROGRA~1\QGIS\apps\Python37\lib\urllib\request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "C:\Mrnmicro\Usagers\droet1\MESDOC~1\PROGRA~1\QGIS\apps\Python37\lib\urllib\request.py", line 569, in error return self._call_chain(args) File "C:\Mrnmicro\Usagers\droet1\MESDOC~1\PROGRA~1\QGIS\apps\Python37\lib\urllib\request.py", line 503, in _call_chain result = func(args) File "C:\Mrnmicro\Usagers\droet1\MESDOC~1\PROGRA~1\QGIS\apps\Python37\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.fullurl, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

MicheleTobias commented 5 years ago

It looks like it's having trouble getting data from the Zotero API. When you started the plugin, did it populate the table with items from you library? I'm wondering if the first API call worked when you started the plugin.

MicheleTobias commented 5 years ago

Oh, also, are you using the plugin from the QGIS official repository or did you load the code from GitHub?

edrouin commented 5 years ago

The data loaded ok in the table. I'm able to add point coordinates data. The problem is only when I press the Save to Zotero button. I got the plugin from QGIS repository. I just installed the latest QGIS 3.4.4.

MicheleTobias commented 5 years ago

Thanks! I was asking if the table loaded because to do that, it has to do an API call as well. If that one is working, but the one in the save function isn't, that will help me figure out why the save API call isn't working. I'll upgrade to 3.4 and see if it breaks. I was on 3.2 because of the memory issue 3.4 was having on windows but I'll give it another shot and see what happens.

ghost commented 5 years ago

HI, I am having a similar save issue on 2 different machines. It is reading the data from zotero but won't save:

An error has occurred while executing Python code:

HTTPError: HTTP Error 404: Not Found Traceback (most recent call last): File "C:/Users/Vader/.qgis2/python/plugins\LiteratureMapper\literature_mapper.py", line 235, in saveZotero item_json = json.load(urllib2.urlopen(request_url)) File "C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\urllib2.py", line 127, in urlopen return _opener.open(url, data, timeout) File "C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\urllib2.py", line 410, in open response = meth(req, response) File "C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\urllib2.py", line 523, in http_response 'http', request, response, code, msg, hdrs) File "C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\urllib2.py", line 448, in error return self._call_chain(args) File "C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\urllib2.py", line 382, in _call_chain result = func(args) File "C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\urllib2.py", line 531, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 404: Not Found

Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] QGIS version: 2.16.0-Nødebo Nødebo, d0b3e39

Python Path: C:/PROGRA~1/QGIS21~1.0/apps/qgis/./python/plugins\processing C:/PROGRA~1/QGIS21~1.0/apps/qgis/./python C:/Users/Vader/.qgis2/python C:/Users/Vader/.qgis2/python/plugins C:/PROGRA~1/QGIS21~1.0/apps/qgis/./python/plugins C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\backports.ssl_match_hostname-3.4.0.2-py2.7.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg C:\PROGRA~1\QGIS21~1.0\bin\python27.zip C:\PROGRA~1\QGIS21~1.0\apps\Python27\DLLs C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\plat-win C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\lib-tk C:\PROGRA~1\QGIS21~1.0\bin C:\PROGRA~1\QGIS21~1.0\apps\Python27 C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\PIL C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\win32 C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\win32\lib C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\Pythonwin C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\wx-2.8-msw-unicode C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg C:\PROGRA~1\QGIS21~1.0\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg C:/Users/Vader/.qgis2//python C:\Users\Vader.qgis2\python\plugins\mmqgis/forms

MicheleTobias commented 5 years ago

@wjreckli It looks like you're using QGIS 2.16. I can't support Literature Mapper for that version of QGIS any more. I would also recommend you check your settings for your Zotero repository and make sure it has both read and write permissions.

MicheleTobias commented 5 years ago

Go to Zotero.org > log in > Settings > Feeds/API > Edit Key > check the read/write permissions

ghost commented 5 years ago

Thanks for the fast reply. I upgraded QGIS and enabled write permissions. Now I get this.

2019-03-11T13:53:28 WARNING Python error : An error has occurred while executing Python code: See message log (Python Error) for more details.

2019-03-11T13:53:28 WARNING Traceback (most recent call last): File "C:/Users/Vader/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LiteratureMapper\literature_mapper.py", line 248, in saveZotero item_json = json.load(urllib.request.urlopen(request_url)) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 531, in open response = meth(req, response) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 569, in error return self._call_chain(args) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 503, in _call_chain result = func(args) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

and then the stack trace:

An error has occurred while executing Python code:

urllib.error.HTTPError: HTTP Error 404: Not Found Traceback (most recent call last): File "C:/Users/Vader/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LiteratureMapper\literature_mapper.py", line 248, in saveZotero item_json = json.load(urllib.request.urlopen(request_url)) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 531, in open response = meth(req, response) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 569, in error return self._call_chain(args) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 503, in _call_chain result = func(args) File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.6.0-Noosa Noosa, 58734527ab

Python Path: C:/PROGRA~1/QGIS3~1.6/apps/qgis/./python C:/Users/Vader/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/Vader/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS3~1.6/apps/qgis/./python/plugins C:\Program Files\QGIS 3.6\bin\python37.zip C:\PROGRA~1\QGIS3~1.6\apps\Python37\DLLs C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib C:\Program Files\QGIS 3.6\bin C:\PROGRA~1\QGIS3~1.6\apps\Python37 C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\win32 C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\win32\lib C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\Pythonwin C:/Users/Vader/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users\Vader\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins

MicheleTobias commented 5 years ago

We're testing a new release that I think doesn't have this problem. Both errors appear to be when the code sends an API request.

MicheleTobias commented 5 years ago

If you wanted to, you could try the Extra Field branch: https://github.com/MicheleTobias/LiteratureMapper/tree/extra-field

ghost commented 5 years ago

Hi, I copied the the code from the extra field branch into the plugin folder with no better result. I feel like we are getting closer...

ghost commented 5 years ago

when I look at your webmap I can see: https://api.zotero.org/users/2338633/collections/NR8XU5N6/items which is accessible.

Mine is "forbidden" https://api.zotero.org/users/5581641/collections/XIZ4PHA2/items I have dug around in the settings without any luck. This must be a zotero issue. Any thoughts on this? thanks again for your help.

MicheleTobias commented 5 years ago

I agree that it is likely a Zotero issue rather than a code issue. I have my API key settings set to read and write permissions for both Personal and Group settings. Also in the Privacy settings, I have my library set to Publish Entire Library.

ghost commented 5 years ago

That did it! it was the "publish entire library."

MicheleTobias commented 5 years ago

Awesome! Thanks for posting that this worked.

MicheleTobias commented 5 years ago

@edrouin have you checked your library settings to see if it's set to "publish entire library"? Sounds like this might solve your problem as well.

edrouin commented 5 years ago

I confirmed, it solved the problem. Publishing the entire library could be some kind of an issue for my organisation. If there were another way arround the problem, it would be great.

Thank you for the support, I think this extension is much needed.

Etienne Drouin edrouin1@gmail.com

Le lun. 11 mars 2019, à 15 h 11, Michele Tobias notifications@github.com a écrit :

@edrouin https://github.com/edrouin have you checked your library settings to see if it's set to "publish entire library"? Sounds like this might solve your problem as well.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MicheleTobias/LiteratureMapper/issues/33#issuecomment-471680663, or mute the thread https://github.com/notifications/unsubscribe-auth/AL5BSBDEc-Jj64oDrPuqrDlWcKoqjEGVks5vVqp7gaJpZM4a-dTg .

MicheleTobias commented 5 years ago

I'll add working on closed libraries to our list of features to work on. The whole thing is very much a work in progress. I appreciate both of you sharing what's not working so we can make it better.