0

I'm trying to open an image from a folder in my network, but python can't find it.

It is a PySimpleGUI small app that shows images.

This is the code related:

img1 = os.path.join(values['-FOLDER-'], img) 
window['IMAGE1'].update(data=convert_to_bytes(img1))

And this is the error it throws:

No such file or directory: '\\\\XXXX.XXXX.XXXX.XXXX\\folder\\image.jpg'

The path is correct and the file does exists.

I have tried doing the same with images localy in my pc and it does work, so I'm guessing the problem is related to accessing the folder in the network.

I can open the folder and the image with the file explorer, after entering user and password to open the folder, I checked the remember credentials box so my user should have acces to it.

What could I do to solve this?

Thanks.

1

1 Answer 1

0

I solved this using pywin32 library and creating a connection to the shared drive.

import win32net    
data = {
    'remote': r'\\XX.XX.XX.XX\Folder', 
    'local': '',
    'username': 'username',
    'password': 'password'
}
win32net.NetUseAdd(None, 2, data)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.