file handling in a server (.py) file using xmlrpc

Discussion in 'Python' started by uwb, Jul 8, 2005.

  1. uwb

    uwb Guest

    I've got a call to glob in a .py file sitting in an apache cgi-bin directory
    which refuses to work while the exact same code works from a python console
    session.

    I'm guessing that in order to read or write files from any sort of a script
    file sitting in the cgi-bin directory on a server, something has to be set
    to allow such activity. I'd appreciate it if anybody with as clue as to
    what that was could tell me about it.
    uwb, Jul 8, 2005
    #1
    1. Advertising

  2. uwb

    Jeremy Jones Guest

    uwb wrote:

    >I've got a call to glob in a .py file sitting in an apache cgi-bin directory
    >which refuses to work while the exact same code works from a python console
    >session.
    >
    >I'm guessing that in order to read or write files from any sort of a script
    >file sitting in the cgi-bin directory on a server, something has to be set
    >to allow such activity. I'd appreciate it if anybody with as clue as to
    >what that was could tell me about it.
    >
    >
    >
    >
    >

    So, what do you mean "refuses to work"? Is the cgi script not executing
    at all? Spitting out an error? If so, what error? (And is it an error
    to the browser calling the cgi script, or in your apache logs?)

    Jeremy Jones
    Jeremy Jones, Jul 8, 2005
    #2
    1. Advertising

  3. uwb

    uwb Guest

    Jeremy Jones wrote:

    > uwb wrote:
    >
    >>I've got a call to glob in a .py file sitting in an apache cgi-bin
    >>directory which refuses to work while the exact same code works from a
    >>python console session.
    >>
    >>I'm guessing that in order to read or write files from any sort of a
    >>script file sitting in the cgi-bin directory on a server, something has to
    >>be set
    >>to allow such activity. I'd appreciate it if anybody with as clue as to
    >>what that was could tell me about it.
    >>
    >>
    >>
    >>
    >>

    > So, what do you mean "refuses to work"? Is the cgi script not executing
    > at all? Spitting out an error? If so, what error? (And is it an error
    > to the browser calling the cgi script, or in your apache logs?)
    >
    > Jeremy Jones



    The script executes, no error messages, but the glob call turns up nothing
    while the identical call running from a console does in fact turn up files
    names as expected.
    uwb, Jul 8, 2005
    #3
  4. uwb

    Jeremy Jones Guest

    uwb wrote:

    >Jeremy Jones wrote:
    >
    >
    >
    >>uwb wrote:
    >>
    >>
    >>
    >>>I've got a call to glob in a .py file sitting in an apache cgi-bin
    >>>directory which refuses to work while the exact same code works from a
    >>>python console session.
    >>>
    >>>I'm guessing that in order to read or write files from any sort of a
    >>>script file sitting in the cgi-bin directory on a server, something has to
    >>>be set
    >>>to allow such activity. I'd appreciate it if anybody with as clue as to
    >>>what that was could tell me about it.
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>

    >>So, what do you mean "refuses to work"? Is the cgi script not executing
    >>at all? Spitting out an error? If so, what error? (And is it an error
    >>to the browser calling the cgi script, or in your apache logs?)
    >>
    >>Jeremy Jones
    >>
    >>

    >
    >
    >The script executes, no error messages, but the glob call turns up nothing
    >while the identical call running from a console does in fact turn up files
    >names as expected.
    >
    >

    Wild guess, but I'm thinking your webserver process doesn't have
    permissions to look in your directory.

    Following is alternating root shell and IPython shell:

    root@qiwi:~ # chmod 777 /bam
    root@qiwi:~ # ls -ld /bam
    drwxrwxrwx 2 root root 96 Jul 8 14:53 /bam

    In [4]: glob.glob("/bam/*txt")
    Out[4]: ['/bam/foo.txt', '/bam/bar.txt']

    root@qiwi:~ # chmod 000 /bam
    root@qiwi:~ # ls -ld /bam
    d--------- 2 root root 96 Jul 8 14:53 /bam

    In [5]: glob.glob("/bam/*txt")
    Out[5]: []


    HTH,

    Jeremy Jones
    Jeremy Jones, Jul 8, 2005
    #4
  5. uwb

    uwb Guest

    Jeremy Jones wrote:

    >>The script executes, no error messages, but the glob call turns up nothing
    >>while the identical call running from a console does in fact turn up files
    >>names as expected.
    >>
    >>

    > Wild guess, but I'm thinking your webserver process doesn't have
    > permissions to look in your directory.
    >
    > Following is alternating root shell and IPython shell:
    >
    > root@qiwi:~ # chmod 777 /bam
    > root@qiwi:~ # ls -ld /bam
    > drwxrwxrwx 2 root root 96 Jul 8 14:53 /bam
    >
    > In [4]: glob.glob("/bam/*txt")
    > Out[4]: ['/bam/foo.txt', '/bam/bar.txt']
    >
    > root@qiwi:~ # chmod 000 /bam
    > root@qiwi:~ # ls -ld /bam
    > d--------- 2 root root 96 Jul 8 14:53 /bam
    >
    > In [5]: glob.glob("/bam/*txt")
    > Out[5]: []
    >
    >
    > HTH,
    >
    > Jeremy Jones



    Thanks! Thing does work when I do globs of the local apache directories.
    uwb, Jul 8, 2005
    #5
    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. Jason Kratz

    xmlrpc server on red hat 9 question

    Jason Kratz, Jun 29, 2003, in forum: Python
    Replies:
    0
    Views:
    772
    Jason Kratz
    Jun 29, 2003
  2. Etienne Posthumus
    Replies:
    1
    Views:
    1,094
    Roger Binns
    Apr 1, 2004
  3. John P. Crackett
    Replies:
    0
    Views:
    198
    John P. Crackett
    Oct 9, 2011
  4. gregarican

    Handling XMLRPC::FaultException

    gregarican, Aug 25, 2005, in forum: Ruby
    Replies:
    3
    Views:
    149
    Daniel Schierbeck
    Aug 25, 2005
  5. Replies:
    1
    Views:
    69
    dieter
    May 7, 2014
Loading...

Share This Page