#1
  1. Wacky hack
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    513
    Rep Power
    14

    Class not loading properly in CGI


    Hullo,

    I've got a very, very odd problem here which I can't seem to solve. I'm creating a class instance in a CGI script, but that instance isn't inheriting all of the methods associated with that file. Confused? Here's what I mean:

    the commands to check:
    import db
    mydb = db.mySQL()
    str(dir(mydb))

    done in a python shell on my machine:
    "['__doc__', '__init__', '__module__', 'connectTime', 'cursor', 'delete', 'fetchRow', 'fetchRows', 'info', 'insert', 'mysql', 'update']"

    in the cgi script online:
    ['connectTime', 'cursor', 'mysql']

    What on earth is going on?
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Hey telex, its a nice idea thats for sure! I gave it a try earlier but i couldnt get it to connect?

    Anyway this is pretty wierd.. i guess.. are both your computer and the server running the same version of Python on the same OS etc? Oh, is it just this class of does this happen with classes from other modules?

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. Wacky hack
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    513
    Rep Power
    14
    Ah, well the Python installation on the web server is 1.5.2, whilst I'm using 2.2.3... could this be it? Is there anything that the 2.x series changed in this regard?

    http://www.newtolinux.org.uk/techne/install.py

    That page shows useful info relating to this problem.
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Could well be , an increadable amount has changed since Python 1.5 although i wasn't Pythoning bach then . I first came across Python a month of two before Python 2 was released..

    So obviously my best sugestion would be UPDATE YOUR PYTHON VERSION - i'd give you a long list of reasons to do this but i'm sure you already have plenty of reasons - and see if that fixes the bug.

    Mark.
    programming language development: www.netytan.com Hula

  8. #5
  9. Wacky hack
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    513
    Rep Power
    14
    Yers, well I can bug my web host to do it, but it'd be good to isolate the problem anyway, in case they don't and so the code is backwards compatable. If anyone knows what they might have done to the class system to cause this problem, I'd appreciate help!

IMN logo majestic logo threadwatch logo seochat tools logo