Thanks. mongod is running, and on the same machine, so I thought
'localhost' was correct although I'm not sure how to confirm that. As
for the port, I did overlook something last night--when mongod started
up it displayed the ports, but they're so similar I didn't spot that
they were different:
Fri Apr 15 20:28:40 [initandlisten] waiting for connections on port
27017
Fri Apr 15 20:28:40 [websvr] web admin interface listening on port
28017
Thinking that 28017 may be the right one for a webpage, I tried
editing my script to specify "connection = Connection('localhost',
28017)" and that didn't work. I also tried using os.environ as you
suggested, including the place where the rest of python is stored and
where I put pymongo, and it actually failed earlier in the script,
unable to find pymongo.
Since it was so keen to look for connection.py etc. in /home/me/
public_html/fff/pymongo/, I tried copying everything to that location
just to see what would happen, and now I seem to be getting a more
detailed error. In connection.py at line 370, it raises
AutoReconnect("could not find master/primary"). Line 369 is "if
_connect", which makes me think it's connecting to *something.*
Unfortunately, I don't seem to be able to use easy_install or pip at
all because it's a shared university machine that has a lot of
permissions roadblocks. I'm only using Python at all after spending
several very frustrating evenings wrangling with the machine trying to
enable PEAR so I could install the PHP driver, and giving up. Getting
this cgi script to run on the command line is by far the closest I've
come to getting a working frontend for this project! :/
On Apr 16, 1:54 am, Bernie Hackett <
ber...@10gen.com> wrote:
> > AutoReconnect: could not find master/primary
>
> Are you sure that mongod is running (at 'localhost:27017')? That error
> means that pymongo couldn't make a connection to mongod.
>
> > Also I don't have any kind of master/slave setup.
>
> If you only have one mongod instance running it is the primary or
> master.
>
> > I started off test.cgi with...
>
> I think what you wanted to do was:
> import os
> os.environ['PYTHONPATH'] = '/home/me/python/mongopython'
>
> You're actually better off just installing pymongo using easy_install
> or pip instead of cloning pymongo master from github. That way you
> don't have to bother with PYTHONPATH at all.
http://api.mongodb.org/python/1.10.1%2B/installation.html