AttributeError: 'module' object has no attribute 'quote'

3,716 views
Skip to first unread message

Duke Dougal

unread,
Jun 11, 2012, 9:57:03 AM6/11/12
to boto-users
Hello there,

I am using the neo branch of boto with Python 3.2. I get the
following error for the code below. Does this make sense to anyone?
Is this a Python3 problem?

ubuntu@:~/devel$ python3.2 s3createfile.py
Traceback (most recent call last):
File "s3createfile.py", line 3, in <module>
bucket = s3.get_bucket('jobapplicationsinbound')
File "/usr/local/lib/python3.2/dist-packages/boto-2.3.0-py3.2.egg/
boto/s3/connection.py", line 372, in get_bucket
bucket.get_all_keys(headers, maxkeys=0)
File "/usr/local/lib/python3.2/dist-packages/boto-2.3.0-py3.2.egg/
boto/s3/bucket.py", line 347, in get_all_keys
'', headers, **params)
File "/usr/local/lib/python3.2/dist-packages/boto-2.3.0-py3.2.egg/
boto/s3/bucket.py", line 297, in _get_all
l.append('%s=%s' % (urllib.quote(k), urllib.quote(str(v))))
AttributeError: 'module' object has no attribute 'quote'
ubuntu@:~/devel$


import boto
s3 = boto.connect_s3()
bucket = s3.get_bucket('jobapplicationsinbound')
key = bucket.new_key('my_key_name')
key.set_contents_from_string('This is a test of S3')

Thanks

Dom V

unread,
Jun 12, 2012, 5:45:31 AM6/12/12
to boto-...@googlegroups.com
+1, I have exactly the same issue, Python 3.2 win32. Anyone have an idea?

/dom



Gregory Taylor

unread,
Jun 12, 2012, 9:44:33 AM6/12/12
to boto-...@googlegroups.com
This is new in Python 3:

"The urllib module has been split into parts and renamed in Python 3 to urllib.request, urllib.parse, and urllib.error"


It sounds like we just need to add this to our compat module.

Greg

On Tue, Jun 12, 2012 at 5:45 AM, Dom V <sig...@djvonline.co.uk> wrote:
+1, I have exactly the same issue, Python 3.2 win32. Anyone have an idea?

/dom



--
You received this message because you are subscribed to the Google Groups "boto-users" group.
To post to this group, send email to boto-...@googlegroups.com.
To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.


Duke Dougal

unread,
Jun 14, 2012, 8:40:15 AM6/14/12
to boto-...@googlegroups.com
Where does it go from here?  How would I know if this was going to be fixed?

thanks


Duke Dougal

unread,
Jun 21, 2012, 10:49:03 PM6/21/12
to boto-...@googlegroups.com
Asking the group again - is this likely to be fixed?  Writing something to S3 is just about the most basic use case of boto and if it doesn;t work with Python3.....

On Wednesday, June 20, 2012 10:39:51 PM UTC+10, Dom wrote:
taking a general scatter-gun approach I ran a few modules through the 2to3 script (in my case, compat, connection & bucket) and this works insofar as I can now connect to the bucket in the same way you were trying:

bucket = s3.get_bucket('mybucket')

whether something will be broken further down the line I don't know, but I've got it to return bucket.get_all_keys() successfully, so that's an improvement.

/dom

Srdjan Grubor

unread,
Aug 10, 2015, 4:24:46 PM8/10/15
to boto-users
This looks to be a problem with python3.2 -> python3.3 method mapping code and with both awscli/botocore. I filed an issue with boto but the quickest way to work around this is to change the first line of awscli (/usr/local/bin/aws) to use python2 and not python3
Reply all
Reply to author
Forward
0 new messages