Re: [web2py] Re: psycopg2 problem

2010-04-02 Thread Thadeus Burgess
Yay! I have seen this happen before when attempting to switch between easy_install and apt-get... egg files get left around, or easy_install creates an egg and apt-get just installs source... so you end up with two places and things get confused. -Thadeus On Fri, Apr 2, 2010 at 5:08 AM, Rich

[web2py] Re: psycopg2 problem

2010-04-02 Thread Richie
I love you! Uninstall, reinstall, restart apache, worked a charm. Would love you know what the probem was, but at least it's fixed now! Thank you all for your input, I'm sure I'll be back with more problems soon, this group is great! On Apr 2, 4:07 am, Thadeus Burgess wrote: > It still must be a

Re: [web2py] Re: psycopg2 problem

2010-04-01 Thread Thadeus Burgess
It still must be a problem with the site-packages. And I wonder if it has something to do with the fact you "had problems" with easy_install. I would try apt-get remove python-psycopg2 then look in your site-packages, make sure to remove ALL instances of psycopg2 egg or src files. Also check yo

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
Yeah, it's all spelled fine (not like I typed it there, sorry!) and the database exists. Obviously if web2py was connecting to PostgreSQL it would give a "database not found" or a "cannot write to database" error or something, not a python "cannot find psycopg2" module. I think now that the questi

[web2py] Re: psycopg2 problem

2010-04-01 Thread Yarko Tymciurak
On Apr 1, 4:40 pm, Richie wrote: > From command line python "db = DAL('postgres://posttg...@localhost: > 5432/appdb')" gives a "FATAL:  no pg_hba.conf entry for host > "127.0.0.1", user "postgres", database "appdb", SSL off" but this is a > different issue that I can sort out later! It is still ac

[web2py] Re: psycopg2 problem

2010-04-01 Thread Graham Dumpleton
On Apr 2, 7:42 am, Thadeus Burgess wrote: > Somod_wsgi will not let you print, Not true. For older versions of mod_wsgi if you use 'print' you need to redirect it to 'sys.stderr' is all. This is because using sys.stdin/sys.stderr in a WSGI application is not portable. Because though people ar

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
>From command line python "db = DAL('postgres://posttg...@localhost: 5432/appdb')" gives a "FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "appdb", SSL off" but this is a different issue that I can sort out later! It is still accessing that postgres server to get that

[web2py] Re: psycopg2 problem

2010-04-01 Thread Yarko Tymciurak
On Apr 1, 4:12 pm, Richie wrote: > Console sys.version gives 2.5.2 (r252:60911, Jan 20 2010, 23:14:04) > \n[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3) : identical! > > What do you need to know about environment? It's a VPS running Ubuntu > 8.04.1 64 bit Minimal, I tried easy_install psycopg2 but had issues

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
Console sys.version gives 2.5.2 (r252:60911, Jan 20 2010, 23:14:04) \n[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3) : identical! What do you need to know about environment? It's a VPS running Ubuntu 8.04.1 64 bit Minimal, I tried easy_install psycopg2 but had issues, then did apt-get python-psycopg2. Got Apa

[web2py] Re: psycopg2 problem

2010-04-01 Thread Yarko Tymciurak
yup... statement 1; april fool's on me (I didn't read the original post accurately enough; Thadeus was right)... Not sure you have found anything interesting yet, though... Tell us more about your environment - ... also, may be time to look at the apache logs; restart the wsgi thread;

Re: [web2py] Re: psycopg2 problem

2010-04-01 Thread Thadeus Burgess
And to triple make sure... from the shell printing sys.version gives exactly the same, date, revision, GCC version ? mod_wsgi was compiled with the same version of python installed? So just to make sure you only get the GlobalName when you access web2py through mod_wsgi ? tburg...@***-dev:~/Appl

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess wrote: > So mod_wsgi will not let you print, try this (before your db=DAL(...) > statement) > > import sys > > tmp_file = open('/p

Re: [web2py] Re: psycopg2 problem

2010-04-01 Thread Thadeus Burgess
So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up t

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
@Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess wrote: > We are confused. > > 1) He said he gets the error when "I try to access default controller". > > 2) He did not say "I try to access psycopg2 from m

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
"python web2py.py -S welcome" gives "Database drivers available: SQLite3, PostgreSQL" and "import psycopg2" is successful. Tried using DAL and just got the same error : "NameError: global name 'psycopg2' is not defined" I feel like such a noob :( On Apr 1, 9:16 pm, Yarko Tymciurak wrote: > On

[web2py] Re: psycopg2 problem

2010-04-01 Thread Richie
Thanks for the quick responses, people, it's my first time using this group and I'm impressed already! My question is definately "HOW can I connect to a postgres db?" My current conn string is db=SQLDB('postgres://postg...@127.0.0.1:5432/ database'). Do I just need to change the SQLDB to a DAL? Wi

Re: [web2py] Re: psycopg2 problem

2010-04-01 Thread Thadeus Burgess
We are confused. 1) He said he gets the error when "I try to access default controller". 2) He did not say "I try to access psycopg2 from my controller". I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are corr

[web2py] Re: psycopg2 problem

2010-04-01 Thread Yarko Tymciurak
On Apr 1, 3:12 pm, Thadeus Burgess wrote: > Make sure mod_wsgi is running the same version of python that you have > psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to "import psycopg2" from that shell will show that you can import i

[web2py] Re: psycopg2 problem

2010-04-01 Thread Yarko Tymciurak
On Apr 1, 3:07 pm, Yarko Tymciurak wrote: > Massimo can explain to you how this happens, but this is not a problem > - it's a feature: ... that is, gluon/dal.py trys to import psycopg2 as it builds up a list of available drivers; you just can't see psycopg2, and that's a good thing. If you want

[web2py] Re: psycopg2 problem

2010-04-01 Thread Yarko Tymciurak
Massimo can explain to you how this happens, but this is not a problem - it's a feature: >From your web2py directory, if you do: python web2py.py -S welcome -M to get a web2py application context shell, with your models imported, you also get: In [1]: psycopg2 --