Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Python 3 import error in mongodb.rst example #106

Merged
merged 1 commit into from

2 participants

@holgi

The urlparse module has been reorganized in Python 3 and therefore leads to an import error in the example "init.py" file.

@holgi holgi Python 3 import error in mongodb.rst example
The urlparse module has been reorganized in Python 3 and therefore leads to an import error in the example "__init__.py" file.
b984f99
@holgi holgi commented on the diff
database/mongodb.rst
((11 lines not shown))
from gridfs import GridFS
- from urlparse import urlparse
@holgi
holgi added a note

moved this upwards in the file, to optically glue together the GridFS and pymongo import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@tseaver tseaver merged commit 1ad8879 into Pylons:master
@tseaver
Owner

Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 28, 2014
  1. @holgi

    Python 3 import error in mongodb.rst example

    holgi authored
    The urlparse module has been reorganized in Python 3 and therefore leads to an import error in the example "__init__.py" file.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 database/mongodb.rst
View
8 database/mongodb.rst
@@ -22,8 +22,14 @@ attached to each new request::
from pyramid.config import Configurator
+ try:
+ # for python 2
+ from urlparse import urlparse
+ except ImportError:
+ # for python 3
+ from urllib.parse import urlparse
+
from gridfs import GridFS
- from urlparse import urlparse
@holgi
holgi added a note

moved this upwards in the file, to optically glue together the GridFS and pymongo import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
import pymongo
Something went wrong with that request. Please try again.