Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-05-2008, 09:55 PM   #1
Senior Member
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
mod_python - functions not updating immediately - takes a few refreshes. why?

I have an SQL class that does all my database interaction, so when I need some database stuff, I simply import my sql class, make an sql object & ask for it's methods. The problem is that editing the file doesn't always immediately take. For instance, I just added a function to my sql class, but I keep getting an error that the function is not defined, when it clearly is.

I've also had random problems where, after a change, sometimes the change is seen, sometimes it isn't... so I might get a key error on a returned dictionary, but simply hitting refresh (maybe more than once) will make the error go away. Now, I know there isn't a key error because I fill that particular key explicitly, by hand, but still, sometimes I get the error.

If it matters, I'm doing a simple "import" on a mod_python/psp page in a script section

My import looks like:

if string.find(req.uri,"/dev/") >= 0:
    webroot = "/local/htdocs/dev/dailies"  
    webroot = "/local/htdocs/dailies"
import sql  # lives in webroot
reload(sql) # not sure if this helps
any ideas why this is happening? It's incredibly frustrating.
Old 05-08-2008, 09:12 PM   #2
Senior Member
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
So i did some digging and found the problem. sys.path has TONS of crap in it - many of the entries are repeats. My problem was related to the fact that I have a dev and a live site running on the same machine. The live site appending the live path to sys.path & the dev site was appending the dev path to sys.path. In fact, both paths were in sys.path (many times over), so the solution involved selectively removing elements from sys.path, then adding only the correct ones back in.

problem solved.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_python - is there an equivalent to $_SERVER['PHP_SELF'] in mod_python? BrianK Programming 2 04-28-2008 09:46 PM
apache/mod_python problem: ImportError: No module named mod_python.apache BrianK Linux - Software 2 10-10-2007 05:13 PM
Apache server status and page refreshes thetawaverider Linux - Server 1 05-22-2007 11:35 PM
ncurses + fork, how to control refreshes?? Yerp Programming 4 08-09-2005 02:42 PM
my X refreshes slowly Slackware 1 05-20-2005 03:02 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration