Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User stadin's Avatar
    Join Date
    Jun 2007
    Posts
    19
    This seems a stupid question. But I don't get any python script working under a subdirectory other than mod_python/py, for example mody_python/py/wiki.

    Another strange thing is that when i copy the file py/logbrowse.py ALONE (so without the accomanying html and log files) from the concept demo to /py/wiki/logbrowse.py and open the url (so "...../py/wiki/logbrowse.py/doIt") it shows the contents of the log - which is not in that directory. So the python handler obviously calls the script in py/logbrowse.py but not the one in the sub dir.

    I'm confused.

    Ben
    Last edited by stadin; 2007-06-12 at 04:05.

  2. #2
    Nokia Developer Expert jhnwkmn's Avatar
    Join Date
    Mar 2003
    Posts
    457
    Quote Originally Posted by stadin
    This seems a stupid question. But I don't get any python script working under a subdirectory other than mod_python/py, for example mody_python/py/wiki.
    The python scripts work in mod_python/py because of the .htaccess file in the same directory.
    Code:
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    #PythonDebug On
    Put a similar one in the directory where you want to run your scripts. When developing, remove the # in front of PythonDebug On as that will cause mod_python to print the stack-trace in case of a problem in a Python script.

    Johan

  3. #3
    Registered User stadin's Avatar
    Join Date
    Jun 2007
    Posts
    19
    I already have a .htaccess with this entries. For convenience, here is a copy&paste of the .htaccess in py/wikipy

    Code:
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On
    This is from my httpd.conf

    Code:
    <Directory "C:/data/apache/mod_python">
    AllowOverride All
    </Directory>
    
    #############
     <Directory E:/apache/htdocs/>
         AddHandler python-program .py
         PythonHandler helloworld
         Order allow,deny
         Allow from all
     </Directory>
    
     <Directory "C:/data/apache/mod_python/py">
         AddHandler python-program .py
         PythonHandler helloworld
         Order allow,deny
         Allow from all
     </Directory>
    This is what http://127.0.0.1/mod_python/py/wikipy/wikipy.py/doIt prints:
    Code:
    Not Found
    
    The requested URL /mod_python/py/wikipy/wikipy.py/doIt was not found on this server.
    Apache/2.0.52 (symbian_s60) DAV/2 mod_python/3.1.3 Python/2.2.2 Server at x.x.x.x Port 80

  4. #4
    Nokia Developer Expert jhnwkmn's Avatar
    Join Date
    Mar 2003
    Posts
    457
    Quote Originally Posted by stadin
    ...
    The requested URL /mod_python/py/wikipy/wikipy.py/doIt was not found on this server.
    This may now be a silly question, but you do have a doIt function in your wikipy.py script?

    Incidentally, in the first posting you wrote:
    Another strange thing is that when i copy the file py/logbrowse.py ALONE (so without the accomanying html and log files) from the concept demo to /py/wiki/logbrowse.py and open the url (so "...../py/wiki/logbrowse.py/doIt") it shows the contents of the log - which is not in that directory. So the python handler obviously calls the script in py/logbrowse.py but not the one in the sub dir.
    I'm pretty certain it was the .../py/wiki/logbrowse.py script that was executed. The paths to the log-files are hardwired, so they are found even if the script itself is moved.

    Johan

  5. #5
    Registered User stadin's Avatar
    Join Date
    Jun 2007
    Posts
    19
    Well, I got it running now.
    In the httpd.conf the python handler should be mod_python.publisher not helloworld.

  6. #6
    Nokia Developer Expert jhnwkmn's Avatar
    Join Date
    Mar 2003
    Posts
    457
    Quote Originally Posted by stadin
    Well, I got it running now.
    Ok, that's good.
    In the httpd.conf the python handler should be mod_python.publisher not helloworld. I think this should be changed in the default httpd.conf for the next version.
    Ahem, where did you find helloworld? I'm pretty certain the default httpd.conf does not contain anything like that.

    Br,
    JOhan

  7. #7
    Registered User stadin's Avatar
    Join Date
    Jun 2007
    Posts
    19
    Quote Originally Posted by jhnwkmn
    Ok, that's good.

    Ahem, where did you find helloworld? I'm pretty certain the default httpd.conf does not contain anything like that.

    Br,
    JOhan
    Yes, sorry my fault. I edited my previous post but you were faster

  8. #8
    Registered User stadin's Avatar
    Join Date
    Jun 2007
    Posts
    19
    Well it finally is really a bug. When the file contains a "*py.py" in it's name and is in a sub directory. I renamed the file and it works!

    I'm able to reproduce the following:
    - create a sub directory "wikipy" under mod_python/py
    - put the file "wikipy.py" from the link below in the and open the url
    127.0.0.1/mod_python/py/wikipy/wikipy.py/doIt

    ==> You will get a 404 (file not found)

    - now rename the file to ie "wiki.py"

    The url 127.0.0.1/mod_python/py/wikipy/wiki.py/doIt will show as expected

    file (same as logbrowser.py from the demos)
    http://homepages.fh-giessen.de/~hg12799/wikipy.py

  9. #9
    Nokia Developer Expert jhnwkmn's Avatar
    Join Date
    Mar 2003
    Posts
    457
    Quote Originally Posted by stadin
    Well it finally is really a bug. When the file contains a "*py.py" in it's name and is in a sub directory. I renamed the file and it works!
    Hmm, that's really interesting; I wonder what's going on.

    Thanks for the report.

    Johan

Similar Threads

  1. Please help installing Python libraries on S60
    By ericroijen in forum Python
    Replies: 11
    Last Post: 2009-07-18, 10:43
  2. Python for Series 60 released on Forum Nokia!
    By eriksmartt in forum Python
    Replies: 5
    Last Post: 2009-07-14, 17:00
  3. How to install python to S60 Emulator?
    By xiximato in forum Python
    Replies: 14
    Last Post: 2009-03-10, 12:13
  4. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Python
    Replies: 35
    Last Post: 2008-01-17, 09:12
  5. Replies: 3
    Last Post: 2007-03-13, 06:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved