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, Richie <[email protected]> wrote:
> 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 <[email protected]> wrote:
>> 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 your local user instance of
>> python modules.
>>
>> Then once you are sure its clean, attempt to reinstall with apt-get.
>>
>> -Thadeus
>>
>> On Thu, Apr 1, 2010 at 8:50 PM, Richie <[email protected]> wrote:
>> > 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 question that needs answering is why can't WSGI
>> > web2py see psycop2 even though terminal web2py can...? I'm not gonna
>> > say BUG, but I can't work out what Im doing wrong!
>>
>> > On Apr 2, 1:40 am, Yarko Tymciurak <[email protected]>
>> > wrote:
>> >> On Apr 1, 4:40 pm, Richie <[email protected]> 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 accessing that
>> >> > postgres server to get that error, which web2py isn't.
>>
>> >> A really basic check:  have you created the database, "appdb", and
>> >> given it no-password rights to user "posttgres" (? is that use spelled
>> >> correctly???) for at least read and modify?
>>
>> >> - Yarko
>>
>> >> > "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 <[email protected]> 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 <[email protected]> 
>> >> > > 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 <[email protected]> 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 
>> >> > > >> <[email protected]> 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 <[email protected]> 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
>>
>> >> > > >> >> <[email protected]> wrote:
>> >> > > >> >> > On Apr 1, 3:12 pm, Thadeus Burgess <[email protected]> 
>> >> > > >> >> > 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 
>> >> > > >> >> >> <[email protected]> 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 
>> >> > > >> >> >> > [email protected].
>> >> > > >> >> >> > To unsubscribe from this group, send email to 
>> >> > > >> >> >> > [email protected].
>> >> > > >> >> >> > 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 [email protected].
>> >> > > >> >> > To unsubscribe from this group, send email to 
>> >> > > >> >> > [email protected].
>> >> > > >> >> > 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 [email protected].
>> >> > > >> > To unsubscribe from this group, send email to 
>> >> > > >> > [email protected].
>> >> > > >> > 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 [email protected].
>> >> > > > To unsubscribe from this group, send email to 
>> >> > > > [email protected].
>> >> > > > 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 [email protected].
>> > To unsubscribe from this group, send email to 
>> > [email protected].
>> > 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to