Skip to content

Use os.path instead of ntpath to improve cross-platform compatibility #961

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

Open
jacopotediosi opened this issue May 3, 2025 · 0 comments

Comments

@jacopotediosi
Copy link

This project currently uses the ntpath module for path manipulations. While this works in many cases, ntpath is specific to Windows and may result in incorrect behavior on non-Windows platforms such as Linux or macOS.

The os.path module automatically selects the appropriate path implementation for the current operating system (ntpath on Windows, posixpath on Unix-like systems), making it the preferred choice for cross-platform compatibility.

Unless there is a specific need for Windows-style path handling, I recommend replacing all occurrences of ntpath in utility.py with os.path, especially considering that OctoPrint is most commonly used on Linux-based systems like Raspberry Pi (OctoPi).

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

No branches or pull requests

1 participant