On Apr 2, 7:42 am, Thadeus Burgess <thade...@thadeusb.com> 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 are lazy and wouldn't fix their code and instead
just want to blame mod_wsgi and say it is broken, more recent mod_wsgi
versions don't try and make people write portable code any more and
allow them to hang themselves by using 'print' to sys.stdout.

A post from a year ago about this can be found at:

  http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html

So, use mod_wsgi 3.X and there is no restriction.

Graham

> 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 versionmod_wsgiis 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 suremod_wsgiis 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 at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to