Skip to content

Fix url parsing for returned Windows paths#23

Open
bnavigator wants to merge 1 commit into
cxcsds:mainfrom
bnavigator:fix-windows-paths
Open

Fix url parsing for returned Windows paths#23
bnavigator wants to merge 1 commit into
cxcsds:mainfrom
bnavigator:fix-windows-paths

Conversation

@bnavigator

Copy link
Copy Markdown

The file: URL schema for windows paths retains a leading / when parsed with urllib.parse, this does not work with subsequent loads.

Before:

(.win-venv) C:\Users\Greiner\Documents\testfiles\g12>ds9samp_get --debug "fits header"
# Connected: Connection to DS9 8.7 (client c1)
# Command: fits header
DEBUG: ds9.get fits header timeout=10
DEBUG: {'samp.result': {'url': 'file://localhost/C:/Users/Greiner/AppData/Local/Temp/ds982491346065.fits.txt'}, 'samp.status': 'samp.ok'}
DEBUG: DS9 returned data in URL=file://localhost/C:/Users/Greiner/AppData/Local/Temp/ds982491346065.fits.txt
# ds9samp_get (0.1.1): ERROR [Errno 22] Invalid argument: '/C:/Users/Greiner/AppData/Local/Temp/ds982491346065.fits.txt'

After:

(.win-venv) C:\Users\Greiner\Documents\testfiles\g12>ds9samp_get --debug "fits header"
# Connected: Connection to DS9 8.7 (client c1)
# Command: fits header
DEBUG: ds9.get fits header timeout=10
DEBUG: {'samp.result': {'url': 'file://localhost/C:/Users/Greiner/AppData/Local/Temp/ds992336956101.fits.txt'}, 'samp.status': 'samp.ok'}
DEBUG: DS9 returned data in URL=file://localhost/C:/Users/Greiner/AppData/Local/Temp/ds992336956101.fits.txt
XTENSION= 'IMAGE   '           /extension type
BITPIX  =                  -64 /bits per data value
NAXIS   =                    3 /number of axes
(...)

I tested on Linux as well, the parsed paths still work.

@bnavigator

Copy link
Copy Markdown
Author

Any progress here?

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

Successfully merging this pull request may close these issues.

1 participant