bxshi
bxshi

Reputation: 2292

python+mongoengine error, a int is not a int?

The code is

mongoengine.connect('admin', host='xxx.dotcloud.com', port=16333 , username='root', password='pass')

and it shows the error message that:

09:37:43 [www.0] raise TypeError("port must be an instance of int")

I've tried int(16333), still not working.

I'm new to python, could you give me some advise on that? I'm totally confused.

Upvotes: 2

Views: 638

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262939

You can rest assured that 16333 is indeed an int:

>>> isinstance(16333, int)
True

So, the problem must come from elsewhere. Chances are you have an invalid port number set in your MongoDB configuration file, and connect() tries to parse it even if you provide a port argument.

Upvotes: 2

Related Questions