>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 error, which web2py isn't.

"import psycopg2" works perfectly.

Seems like web2py's dal.py module cannot find psycop2 even though
command line python can, but I have no idea why. Path probs? I'm
clueless!


On Apr 1, 9:55 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> 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:~/Applications/web2py$ python web2py.py -S welcome
>
> >>> db = DAL('postgres://user:p...@localhost:1234/database')
>
> Correct?
>
> and
>
> tburg...@***-dev:~/Applications/web2py$ python
>
> >>> import psycopg2
>
> -Thadeus
>
> On Thu, Apr 1, 2010 at 2:46 PM, Richie <richie.d...@googlemail.com> wrote:
> > 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 <thade...@thadeusb.com> wrote:
> >> 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 the file, and make sure the version corresponds
> >> to the one your shell is using.
>
> >> Probably not the most elegant way, but its quick.
>
> >> -Thadeus
>
> >> On Thu, Apr 1, 2010 at 2:39 PM, Richie <richie.d...@googlemail.com> wrote:
> >> > @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 <thade...@thadeusb.com> 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 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 correct.
>
> >> >> -Thadeus
>
> >> >> On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak
>
> >> >> <resultsinsoftw...@gmail.com> wrote:
> >> >> > On Apr 1, 3:12 pm, Thadeus Burgess <thade...@thadeusb.com> 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 it fine from
> >> >> > the web2py app level;   gluon.dal imports it, and your app doesn't get
> >> >> > to see it for a reason.
>
> >> >> >> -Thadeus
>
> >> >> >> On Thu, Apr 1, 2010 at 1:48 PM, Richie <richie.d...@googlemail.com> 
> >> >> >> wrote:
> >> >> >> > I can import psycopg2 from a python shell, but I'm getting 
> >> >> >> > "NameError:
> >> >> >> > global name 'psycopg2' is not defined" when I try to access my 
> >> >> >> > default
> >> >> >> > controller. I'm setup with Apache and MOD WSGI. Anyone got any 
> >> >> >> > ideas?
>
> >> >> >> > Thanks!
>
> >> >> >> > Rich
>
> >> >> >> > --
> >> >> >> > You received this message because you are subscribed to the Google 
> >> >> >> > Groups "web2py-users" group.
> >> >> >> > To post to this group, send email to web...@googlegroups.com.
> >> >> >> > To unsubscribe from this group, send email to 
> >> >> >> > web2py+unsubscr...@googlegroups.com.
> >> >> >> > For more options, visit this group 
> >> >> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> >> >> > --
> >> >> > You received this message because you are subscribed to the Google 
> >> >> > Groups "web2py-users" group.
> >> >> > To post to this group, send email to web...@googlegroups.com.
> >> >> > To unsubscribe from this group, send email to 
> >> >> > web2py+unsubscr...@googlegroups.com.
> >> >> > For more options, visit this group 
> >> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "web2py-users" group.
> >> > To post to this group, send email to web...@googlegroups.com.
> >> > To unsubscribe from this group, send email to 
> >> > web2py+unsubscr...@googlegroups.com.
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to