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

Using same code in Windows and Linux to access remote paths #200

Open
guidocioni opened this issue Aug 2, 2022 · 2 comments
Open

Using same code in Windows and Linux to access remote paths #200

guidocioni opened this issue Aug 2, 2022 · 2 comments

Comments

@guidocioni
Copy link

I created a client to upload some documents on a SMB share.
As I created and tested the script under Linux I never thought of converting all the path explicit references to something not OS-dependent.
Unfortunately, I now have people running the script on Windows.
I managed to change all path references in my script using Pathlib so that they will work regardless of the system. However, as far as I understand, pysmb does not accept Pathlib object but just plain string. This means that commands like this

conn.storeFile(share_folder, folder + '/' + filename, localFile)

will fail over Windows as the SMB folder will have a different representation.

So...is there a way to re-use the same code on Windows and Linux to access a SMB share without having to write 2 different versions?

@miketeo
Copy link
Owner

miketeo commented Aug 2, 2022

@guidocioni Please continue to use forward slashes '/' for the remote SMB paths. pysmb should handle these paths independently of the OS.

@guidocioni
Copy link
Author

ok that's good news!

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

2 participants