How to read a file from another server? Newbie

Discussion in 'Python' started by Sean Berry, Apr 26, 2004.

  1. Sean Berry

    Sean Berry Guest

    I am trying to read in a file from another server.

    If I try
    x = open("servername:/path/to/file", "r")

    I get the following error:
    IOError: [Errno 2] No such file or directory: 'servername:/path/to/file'


    Sorry for the easy question, but couldn't find anything on google.

    --
     
    Sean Berry, Apr 26, 2004
    #1
    1. Advertising

  2. Sean Berry wrote:
    > I am trying to read in a file from another server.
    >
    > If I try
    > x = open("servername:/path/to/file", "r")


    x = open("servername://path/to/file", "r")

    >
    > I get the following error:
    > IOError: [Errno 2] No such file or directory:
    > 'servername:/path/to/file'
     
    Edward Diener, Apr 26, 2004
    #2
    1. Advertising

  3. Sean Berry

    Ivan Voras Guest

    Edward Diener wrote:

    > Sean Berry wrote:
    >
    >>I am trying to read in a file from another server.
    >>
    >>If I try
    >>x = open("servername:/path/to/file", "r")

    >
    >
    > x = open("servername://path/to/file", "r")


    Um, what does this to? What protocol does it use?
     
    Ivan Voras, Apr 27, 2004
    #3
  4. Sean Berry

    djw Guest

    Ivan Voras wrote:
    > Edward Diener wrote:
    >
    >> Sean Berry wrote:
    >>
    >>> I am trying to read in a file from another server.
    >>>
    >>> If I try
    >>> x = open("servername:/path/to/file", "r")

    >>
    >>
    >>
    >> x = open("servername://path/to/file", "r")

    >
    >
    > Um, what does this to? What protocol does it use?


    I can see how this might work for a Windows server, but wouldn't the
    forward slashes need to be back slashes? And the path to the file would
    have to be a shared drive on the server.

    -D
     
    djw, Apr 27, 2004
    #4
  5. Sean Berry

    Sean Berry Guest

    ssh I think.


    "Ivan Voras" <ivoras@__geri.cc.fer.hr> wrote in message
    news:c6k9fh$3t9$...
    > Edward Diener wrote:
    >
    > > Sean Berry wrote:
    > >
    > >>I am trying to read in a file from another server.
    > >>
    > >>If I try
    > >>x = open("servername:/path/to/file", "r")

    > >
    > >
    > > x = open("servername://path/to/file", "r")

    >
    > Um, what does this to? What protocol does it use?
     
    Sean Berry, Apr 27, 2004
    #5
  6. Sean Berry

    Peter Hansen Guest

    djw wrote:

    > Ivan Voras wrote:
    >> Edward Diener wrote:
    >>> x = open("servername://path/to/file", "r")

    >>
    >> Um, what does this to? What protocol does it use?

    >
    > I can see how this might work for a Windows server, but wouldn't the
    > forward slashes need to be back slashes? And the path to the file would
    > have to be a shared drive on the server.


    "Might work" being the operative words. Actually "won't work"
    is more correct, though. ;-)

    Two points:

    1. Forward slashes are perfectly fine on Windows,
    provided you are not passing the path to the shell/command line/cmd.exe
    or whatever. Internally Windows can cope with forward slashes very
    nicely, and they often make it easier or more readable than resorting
    to raw strings with r'path\file' all the time.

    2. Its unlikely the server name should come first and with a colon
    following. More likely //servername/path/to/file is closer to what
    is wanted.

    -Peter
     
    Peter Hansen, Apr 27, 2004
    #6
  7. Sean Berry

    bobb Guest

    Sean, what kind of server are you trying to get at where the file exists?

    bobb

    "Sean Berry" <> wrote in message
    news:Yyjjc.2071$Jy3.1146@fed1read03...
    > ssh I think.
    >
    >
    > "Ivan Voras" <ivoras@__geri.cc.fer.hr> wrote in message
    > news:c6k9fh$3t9$...
    > > Edward Diener wrote:
    > >
    > > > Sean Berry wrote:
    > > >
    > > >>I am trying to read in a file from another server.
    > > >>
    > > >>If I try
    > > >>x = open("servername:/path/to/file", "r")
    > > >
    > > >
    > > > x = open("servername://path/to/file", "r")

    > >
    > > Um, what does this to? What protocol does it use?

    >
    >
     
    bobb, Apr 30, 2004
    #7
  8. Sean Berry

    Sean Berry Guest

    I have resolved the issue. I am just going to run the cgi script from the
    server the file is on. If anyone out there is interested I am getting close
    to finishing a script that does recursive digs for MX, A, and NS records for
    a given domain, or list of domains.

    Sean

    "bobb" <> wrote in message
    news:v4hkc.4707$...
    > Sean, what kind of server are you trying to get at where the file exists?
    >
    > bobb
    >
    > "Sean Berry" <> wrote in message
    > news:Yyjjc.2071$Jy3.1146@fed1read03...
    > > ssh I think.
    > >
    > >
    > > "Ivan Voras" <ivoras@__geri.cc.fer.hr> wrote in message
    > > news:c6k9fh$3t9$...
    > > > Edward Diener wrote:
    > > >
    > > > > Sean Berry wrote:
    > > > >
    > > > >>I am trying to read in a file from another server.
    > > > >>
    > > > >>If I try
    > > > >>x = open("servername:/path/to/file", "r")
    > > > >
    > > > >
    > > > > x = open("servername://path/to/file", "r")
    > > >
    > > > Um, what does this to? What protocol does it use?

    > >
    > >

    >
    >
     
    Sean Berry, Apr 30, 2004
    #8
  9. Sean Berry

    Steve Holden Guest

    Sean Berry wrote:

    > I have resolved the issue. I am just going to run the cgi script from the
    > server the file is on. If anyone out there is interested I am getting close
    > to finishing a script that does recursive digs for MX, A, and NS records for
    > a given domain, or list of domains.
    >
    > Sean
    >

    Without in any way wishing to rain on your parade, dnspython
    (http://www.dnspython.org/) is great for all DNS functionality.

    regards
    Steve
     
    Steve Holden, Apr 30, 2004
    #9
  10. Sean Berry

    Steve Holden Guest

    Sean Berry wrote:

    > I have resolved the issue. I am just going to run the cgi script from the
    > server the file is on. If anyone out there is interested I am getting close
    > to finishing a script that does recursive digs for MX, A, and NS records for
    > a given domain, or list of domains.
    >
    > Sean
    >

    Without in any way wishing to rain on your parade, dnspython
    (http://www.dnspython.org/) is great for all DNS functionality.

    regards
    Steve
     
    Steve Holden, Apr 30, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dhanasankar S via DotNetMonster.com

    How to read the BODY of HTML file from another HTML file using javascript?

    Dhanasankar S via DotNetMonster.com, Feb 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    498
    =?Utf-8?B?dHBlcnJp?=
    Feb 28, 2005
  2. Justme
    Replies:
    9
    Views:
    627
    clayne
    Oct 1, 2006
  3. TreatmentPlant
    Replies:
    9
    Views:
    462
    Markus Schoder
    Apr 16, 2006
  4. Sreejith K
    Replies:
    24
    Views:
    1,065
    Sreejith K
    Mar 24, 2009
  5. Alex Dowad
    Replies:
    4
    Views:
    299
    Michel Demazure
    May 1, 2010
Loading...

Share This Page