question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consistent File Access (using pathlib.Path instead of os.path)

See original GitHub issue

We use both os and pathlib libraries for reading/writing files. I’d like to fix up the code to use either or. We can have a discussion on which is better here, but it seems a bit weird having two libs in that do the same thing

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fenhlcommented, Jul 9, 2018

For example, this line: https://github.com/mtgjson/mtgjson-python/blob/8666ea0e10c152e97936c2440857512604e10f79/mtgjson4/mtg_http.py#L135

could be rewritten as:

if (mtgjson4.mtg_storage.CACHE_DIR / 'set_mids' / f'{set_name}.txt').exists():
0reactions
ZeldaZachcommented, Jul 9, 2018

Sounds like a solid argument to me.

Ticket update: Move away from os.path -> pathlib.Path

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python 3's pathlib Module: Taming the File System
With pathlib , file paths can be represented by proper Path objects instead of plain strings as before. These objects make code dealing...
Read more >
Why You Should Start Using Pathlib as an Alternative to the ...
Let's assume you have a Path object that points to a directory. Pathlib allows you to easily iterate over that directory's content and...
Read more >
Pathlib vs. os.path.join in Python - Stack Overflow
The documentation for pathlib says that "For low-level path manipulation ... (commas instead of slashes) to join paths with pathlib as well:.
Read more >
Introduction to the Python Pathlib Module - Stack Abuse
The Pathlib module in Python simplifies the way in working with files and folders. The Pathlib module is available from Python 3.4 and ......
Read more >
pathlib and paths with arbitrary bytes - Stein Magnus Jodal
In this post, I'll have a look at how pathlib can be used to handle file paths containing arbitrary bytes, as this is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found