Skip to content

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

@guidocioni

Description

@guidocioni

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions