Skip to content

Conversation

@qianyun210603
Copy link
Contributor

Description

Fix bug in init_instance_by_config when object are provided by pickled file.

Motivation and Context

At least on Windows, the parsing of file:// link can have extra backslash due to os.path.join with empty string:

from urllib.parse import urlparse
import os
import os.path
Out[5]: ParseResult(scheme='file', netloc='E:\\qlib_data\\rqdata_convert\\obj.pkl', path='', params='', query='', fragment='')
pr = urlparse(r"file://E:\qlib_data\rqdata_convert\obj.pkl")
pr
Out[6]: ParseResult(scheme='file', netloc='E:\\qlib_data\\rqdata_convert\\obj.pkl', path='', params='', query='', fragment='')
os.path.join(pr.netloc, pr.path)
Out[7]: 'E:\\qlib_data\\rqdata_convert\\obj.pkl\\'

which results to file loading error.

How Has This Been Tested?

minor change, don't think it needs test.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@github-actions github-actions bot added the waiting for triage Cannot auto-triage, wait for triage. label Mar 23, 2023
@Fivele-Li Fivele-Li merged commit 7393786 into microsoft:main Mar 24, 2023
@Fivele-Li
Copy link
Contributor

Thank you so much for taking the time to submit your pull request! Your contribution is greatly appreciated.

@qianyun210603 qianyun210603 deleted the bugfix branch March 25, 2023 05:47
@you-n-g you-n-g added bug Something isn't working and removed waiting for triage Cannot auto-triage, wait for triage. labels Jun 25, 2023
gaogen123 pushed a commit to gaogen123/qlib that referenced this pull request Sep 13, 2025
[BUGFIX] potential file// url parsing error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants