Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding issues on Mac OSX for metadata.txt #91

Closed
gillyjuwa opened this issue Mar 6, 2019 · 9 comments
Closed

Encoding issues on Mac OSX for metadata.txt #91

gillyjuwa opened this issue Mar 6, 2019 · 9 comments

Comments

@gillyjuwa
Copy link

Here's what I did


Here's what I got


Here's what I was expecting


Here's what I think could be improved

@gillyjuwa
Copy link
Author

Hi team,

Please would you help me resolve the issues with installing and running ORS Tools. I've tried installing from the QGIS plugin repository AND by downloading the zip file and keep getting the following error:
Couldn't load plugin 'ORStools'

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 155: ordinal not in range(128)
Traceback (most recent call last):
File "/Applications/QGIS3.6.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 309, in loadPlugin
import(packageName)
File "/Applications/QGIS3.6.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/gillianjean/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ORStools/init.py", line 59, in
METADATA.read(os.path.join(BASE_DIR, 'metadata.txt'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 697, in read
self._read(fp, filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 1015, in _read
for lineno, line in enumerate(fp, start=1):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 155: ordinal not in range(128)

Python version: 3.6.6 (v3.6.6:4cf1f54eb7, Jun 26 2018, 19:50:54) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
QGIS version: 3.6.0-Noosa Noosa, exported

Python Path:
/Applications/QGIS3.6.app/Contents/MacOS/../Resources/python
/Users/gillianjean/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/gillianjean/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS3.6.app/Contents/MacOS/../Resources/python/plugins
/Library/Frameworks/SQLite3.framework/Versions/E/Python/3.6
/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
/Users/gillianjean/Library/Application Support/QGIS/QGIS3/profiles/default/python

Kind regards

Gillian

@nilsnolde
Copy link
Contributor

Looks very much you have encoding problems. Seems a little weird, since this Python 3.x, which should default strings to UTF-8. Anyways, might be the configparser has problems (on Mac only? After 800 downloads this is the first I hear about it).

I patched real quick. Can you please try branch hotfix-#91-encoding_problems? It's the ZIP, but seems like you know what to do with it. Please let me know if this fixed your issue.

@gillyjuwa
Copy link
Author

gillyjuwa commented Mar 7, 2019 via email

@nilsnolde
Copy link
Contributor

nilsnolde commented Mar 7, 2019

What, still the same error? And you tried the patched zip file, you're sure? You have to uninstall and re-install the new patch with the zip. Can you pls paste the error output again?

@gillyjuwa
Copy link
Author

gillyjuwa commented Mar 7, 2019 via email

@nilsnolde
Copy link
Contributor

nilsnolde commented Mar 7, 2019

You're not loading the new patch version. I patched only this line of code (it's in your error):

METADATA.read(os.path.join(BASE_DIR, 'metadata.txt'))

You'll have to uninstall the ORS Tools plugin that you installed from the plugin manager. And install the ZIP verison I linked above! That line has to read

METADATA.read(os.path.join(BASE_DIR, 'metadata.txt'), encoding='utf-8')

For the rest: your problem is not your fault. There's some shit going on with your encoding on your system, but it's beyond me why it would do that. The last resort is to re-install QGIS. That's not normal behavior.

50000 x 250 you'll calculate within 3 days on the free quota and the matrix API. I really don't recommend using QGIS for that, but you can try.

@nilsnolde
Copy link
Contributor

nilsnolde commented Mar 7, 2019

Ah now I see. That was confusing. No, that's not how you install the ZIP package from Github! Pls read my README.md. You have to extract the ZIP and zip up the ORSTools subdirectory.

@gillyjuwa
Copy link
Author

Hi Nils,
So I extracted the ZIP and then zipped up the ORSTools subdirectory and then installed from that. It says it has installed succesfully but does not appear on the plugins drop down menu as per You Tube demo.
I have tried using the matrix api through the web and ......no luck! Tried running a small batch.

It must have something to do with the daily limits on the API, can we override that and is there a step by step tutorial to get me through this?

Kind regards

Gillian

@nilsnolde
Copy link
Contributor

Did you activate the plugin in the Plugin Manager? It will definitely show up in the toolbar or in the Web (not the Plugin) menu, I just tried the exact same zip myself. What is a You Tube demo?

Of course, you can our Python lib if QGIS doesn't work for you. I'm afraid I can't help you from here on. It's all there, you just need to make it work yourself.

And it definitely has nothing to do with daily limits.

@nilsnolde nilsnolde changed the title Installation problems Encoding issues on Mac OSX for metadata.txt Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants