I've a shared folder created (with access to everyone) in Windows. on C:\sharedfolder, so I can access it with:
\\mylocalnetworkip\sharedfolder
Now I want a Python script to write stuff there from another machine.
If I run this simple script on Windows (from my machine, using Python under Windows), it works. It creates the file and writes that content.
file = open(r'\\mylocalnetworkip\sharedfolder\tester.dat', 'w')
file.write('whatever')
file.close()
But if I run the same script in Linux (from another machine, but still on my local network, this means if I ping my IP it works), it doesn't work.
With it doesn't work I mean that it doesn't fail, the strange thing that it creates a file on the same path with the name of the entire
root@mc:/tmp# python tester.py <-- the script with the code above
root@mc:/tmp# ls
\\mylocalnetworkip\sharedfolder\tester.dat tester.py
root@mc:/tmp# cat \\mylocalnetworkip\sharedfolder\tester.dat
whatever
root@mc:/tmp#
Can someone give me a hand and tell me how can I make it work in Linux? Thank you!
PS: I also tested it using '\\\\mylocalnetworkip\\sharedfolder\\tester.dat' with no luck.
root@mc:/tmp# ls \\mylocalnetworkip\sharedfolder. I think you must mount the shared folder first.caton the code I provided. Its content is thewhateverstring, the thing you want to write.ls. You have to "mount" the shared folder first into your linux filesystem. You can not access it before.