Is there any good way to share a given directory over the network?

Or at least, if the directory is already being shared, is there any way for me to get its network path? (Something like

\\190.10.10.1\my_shared_dir\

)

Recommended Answers

All 11 Replies

Seeing your backslashes I assume you operate in windows environment. Would itnot be possible to make permanent mapping to drive letter as the direct net form is not accepted everywhere. Or at least have names set up so that you do not deal directly with IP numbers, which looks clumsy. Or if you expect the directory never to change, maybe network directory path can function? What have you tried, can you give actual error messages you are getting? You are usuing raw strings for directory names aren't you?

Actually, I haven't tried much yet. I can't seem to find any clean way to do this.

My program gets requests as xml files into some input directory, and returns xml responses over another directory.
The program's client may be on some remote computer, which on setup requests its input and output directories, so that it may send me requests, and query my output dir for responses.

Since, as I said, the client may be on another machine, these folders should are remote to it, and I try to figure out how to give him their network paths.

The only idea I thought of, would be that I manually create a shared folder on my local machine, (Named "Input") and send a string of this form to the client:

'\\%s\Input\' % socket.gethostname()

However, I would like it if I wouldn't have to manually share this directory on installation, and it seems like a common enough problem (Is it?) to have a good pythonian solution for it.

I would use something like CherryPy instead.

What is CherryPy supposed to replace?

It is an web programming platform, as your program operates in network. Otherwise you should look doing the socket programming yourself from scratch.

You could also install a ssh server on the server machine and access directories with module paramiko (make sure the ssh server is securely configured). In windows, you can install copssh for example.
(note that when I installed copssh in my windows XP, I had a missing dll which I found here http://cygwin.cybermirror.org/release/attr/libattr1/libattr1-2.4.43-1.tar.bz2 . I then had to move cygattr1.dll in C://program Files/ICW/Bin . You must also allow port 22 to communicate with the outside world in the firewall configuration).

But I already have my networking interfaces (I wish for them to be files-based, as a result of some constraints I have on the system.).

My only problem is publishing the folders I work with over the network. Can CherryPy solve that? (It appears to be used to setup webservers, which doesn't seem like what I need)

Don't really know what an SSH server is, though I believe that SSH be some secure protocol of some sort. Since I have no security requirements for this program, why would I need SSH? By the way, assume I run on windows, if it simplifies things.

Don't really know what an SSH server is, though I believe that SSH be some secure protocol of some sort. Since I have no security requirements for this program, why would I need SSH? By the way, assume I run on windows, if it simplifies things.

An ssh server is a server which allows a remote machine to execute shell commands on your computer, like listing a directory or starting a program, in fact everything you can do in a command line, and also download and upload files. The python module paramiko gives python the ability to do whatever it wants on a remote machine with an ssh server. It only needs to connect the server with your windows user name and password.
You can tell the server that only certain users will be allowed to connect for example, or even create a special user with a hard to find password and restricted privileges.

CherryPy makes your program become the server and can handle normal kinds of file upload stuff and static files. cherryPy can also talk to databases or webservers but do not need one. Keep in mind though that I have not used it yet myself in real life, but would like to try it sometime soon.
http://www.cherrypy.org/wiki/FileUpload
http://www.packtpub.com/article/overview-cherrypy-a-web-application-server-1

why dont you try the ftp lib

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.