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

Use os.sep for path separators #118

Merged
merged 1 commit into from
Jun 28, 2019

Conversation

aaronsnoswell
Copy link

Supports a fix for #117

@alanjfs
Copy link

alanjfs commented Feb 21, 2019

A perhaps even more cross-platform alternative would be to use os.path.split() which accounts for not just the correct path separator, but all of them (as Windows does support / too) including erroneous ones.

>>> import os
>>> os.path.split("mypath/")
('mypath', '')
>>> os.path.split("mypath\\")
('mypath', '')
>>> os.path.split(r"mypath\/")
('mypath', '')
>>> os.path.split(r"mypath///")
('mypath', '')
>>> os.path.split("mypath")
('', 'mypath')

@bchess bchess merged commit 2523ee9 into openai:master Jun 28, 2019
@k3KAW8Pnf7mkmdSMPHz27
Copy link

Out of curiosity, why is the latter part of,
if osp.isdir(logdir) and logdir[-1]=='/':
there at all?

mahdinobar pushed a commit to mahdinobar/spinningup that referenced this pull request Sep 26, 2024
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.

4 participants