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

AugmentedDiff.get_state() returns False and/or raises ReadTimeout exception on Windows 7, Python 3.7.3 #11

Closed
vitale232 opened this issue Jul 2, 2019 · 6 comments

Comments

@vitale232
Copy link

vitale232 commented Jul 2, 2019

Issue Description

I'm trying to follow the simple AugmentedDiff example from the readme. During my first attempt, the AugmentedDiff.get_state() method returned False. On some subsequent attempts, the method raises an exception from the requests module:

>>> a.get_state()
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='overpass-api.de', port=80): Read timed out. (read timeout=5)

Environment

Windows 7 (64-bit)
Python 3.7.3 (Anaconda Distribution)
conda 4.7.5
osmdiff 0.1.8 (pip install)

Workaround

The workaround seems to be using requests to get the augmented diff sequence number, then manually assign it to the AugmentedDiff.sequence_number property.

>>> from osmdiff import AugmentedDiff
>>> import requests
>>>
>>> a = AugmentedDiff()
>>> response = requests.get(a.base_url  + '/augmented_diff_status')
>>> a.sequence_number = int(response.text)
>>> a.sequence_number
3577361
>>> a.retrieve()
>>> a
AugmentedDiff (1534 created, 343 modified, 125 deleted)
>>>

I believe the use of os.path.join in the AugmentedDiff.get_state method is producing an invalid URL on Windows.

@vitale232 vitale232 changed the title AugmentedDiff.get_state() returns False and/or raises ReadTimeout exception on Windows 7, Python 3.7.3 AugmentedDiff.get_state() returns False and/or raises ReadTimeout exception on Windows 7, Python 3.7.3 Jul 2, 2019
@mvexel
Copy link
Owner

mvexel commented Apr 13, 2021

Hmm your assessment may very well be correct, I haven't tested on Windows. I'll see if I can get a chance to do that, I do have a windows (10) machine but would need to install a python developer environment.. If you can positively confirm that os.path.join is the culprit here, that would help :)

@vitale232
Copy link
Author

Here's some screenshots to help verify... The first screenshot is using Python3.9 in Win10. The second screenshot is using Python3.8 in Ubuntu, via Windows Subsytem for Linux 2:

image

image

Hope that helps, and thanks for the software! :-)

@mvexel
Copy link
Owner

mvexel commented Apr 15, 2021

OK that gives me something to work with! Obviously I am abusing os.path.join to construct a URL when it is meant for file URIs which are OS-dependent. Let me see what I can do here!

@mvexel
Copy link
Owner

mvexel commented Apr 16, 2021

It looks like I need to replace os.path.join with urllib.urlparse.urljoin but I don't have an easy way to test the result on Windows. Anyone able to help here?

@docentYT
Copy link

docentYT commented Nov 9, 2022

#21

@mvexel
Copy link
Owner

mvexel commented May 25, 2024

This should be solved with #28 and the published 0.4. Lmk if there's still issues with it.

@mvexel mvexel closed this as completed May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants