On 29/04/2016 23:39, Bartlomiej Mika wrote:
Salutations!

I have the following python installed: python34-3.4.4_2

I am also using *pip 8.1.1*

I am trying to install *django-tenants* using these two things and python
gives me this error:

% pip install django-tenants


Collecting django-tenants

   Using cached django-tenants-1.1.5.zip

     Complete output from command python setup.py egg_info:

     Traceback (most recent call last):

       File "<string>", line 1, in <module>

       File "/tmp/pip-build-814hp86j/django-tenants/setup.py", line 31, in
<module>

         long_description=open('README.rst').read() if exists("README.rst")
else "",

       File
"/usr/home/django/py-bizmula/env/lib/python3.4/encodings/ascii.py", line
26, in decode

         return codecs.ascii_decode(input, self.errors)[0]

     UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
604: ordinal not in range(128)

The file README.rst has non-ascii characters in it but python is trying
to read it as an ascii file

Specifically it uses the "right single quotation mark" instead of a
"modifier letter apostrophe" or a simple ascii apostrophe

https://tedclancy.wordpress.com/2015/06/03/which-unicode-character-should-represent-the-english-apostrophe-and-why-the-unicode-committee-is-very-wrong/

This would be an automatic thing from the text editor used.

One solution is to patch django-tenants - that could be done in a port
not(?) when using pip directly.

You could patch README.rst to have only ascii chars or patch setup.py
to use -

long_description=open('README.rst', encoding='utf-8').read() if exists("README.rst") else "",

A quick solution for you is to set your locale

Currently you would see the following -
% python3.4
...
>>> import locale
>>> locale.getpreferredencoding()
'US-ASCII'
>>> t = open('README.rst').read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 604: ordinal not in range(128)

If you set your locale to use utf-8 then you won't get this error.

using tcsh -
% setenv  LC_ALL en_US.UTF-8

using sh -
% LC_ALL=en_US.UTF-8;export LC_ALL

% python3.4
...
>>> import locale
>>> locale.getpreferredencoding()
'UTF-8'
>>> t = open('README.rst').read()
>>>

Oddly python2.7 recognises that the file is utf-8 even when the locale
is ascii but python 3.4 and 3.5 don't.

I don't expect to use django-tenants but it is a simple port - if you
want to add yourself as the maintainer you could submit the following
as a new port to https://bugs.freebsd.org


--
FreeBSD - the place to B...Software Developing

Shane Ambler

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       py-django-tenants
#       py-django-tenants/files
#       py-django-tenants/files/patch-setup.py
#       py-django-tenants/pkg-descr
#       py-django-tenants/distinfo
#       py-django-tenants/Makefile
#
echo c - py-django-tenants
mkdir -p py-django-tenants > /dev/null 2>&1
echo c - py-django-tenants/files
mkdir -p py-django-tenants/files > /dev/null 2>&1
echo x - py-django-tenants/files/patch-setup.py
sed 's/^X//' >py-django-tenants/files/patch-setup.py << 
'b5a9328ec52ed953ec3d4cb8d912c784'
X--- setup.py.orig      2016-04-30 02:37:21 UTC
X+++ setup.py
X@@ -28,7 +28,7 @@ setup(
X     url='https://github.com/tomturner/django-tenants',
X     license='MIT',
X     description='Tenant support for Django using PostgreSQL schemas.',
X-    long_description=open('README.rst').read() if exists("README.rst") else 
"",
X+    long_description=open('README.rst', encoding='utf-8').read() if 
exists("README.rst") else "",
X     classifiers=[
X         'Development Status :: 5 - Production/Stable',
X         'Environment :: Web Environment',
b5a9328ec52ed953ec3d4cb8d912c784
echo x - py-django-tenants/pkg-descr
sed 's/^X//' >py-django-tenants/pkg-descr << '1e382cd59afd0dd7f4e62195d6658739'
Xpy-django-tenants enables django powered websites to have multiple
Xtenants by using PostgreSQL schemas.
X
XWWW: https://github.com/tomturner/django-tenants
1e382cd59afd0dd7f4e62195d6658739
echo x - py-django-tenants/distinfo
sed 's/^X//' >py-django-tenants/distinfo << '64febf9fdc0da5179a8f8fb8ac4eb7b3'
XSHA256 (django-tenants-1.1.5.zip) = 
5c2f35f1331db2bfd80f0424a5ad14efc18885ca4e6516ef2bec2cc6dec9b053
XSIZE (django-tenants-1.1.5.zip) = 87579
64febf9fdc0da5179a8f8fb8ac4eb7b3
echo x - py-django-tenants/Makefile
sed 's/^X//' >py-django-tenants/Makefile << 'c970339a333087de71dd54e30a5932e5'
X# Created by: me
X# $FreeBSD$
X
XPORTNAME=      django-tenants
XPORTVERSION=   1.1.5
XCATEGORIES=    www python
XMASTER_SITES=  CHEESESHOP
XPKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
X
XMAINTAINER=    some...@somedomain.com
XCOMMENT=       Tenant support for Django using PostgreSQL schemas
X
XRUN_DEPENDS=   ${PYTHON_PKGNAMEPREFIX}django18>0:www/py-django18 \
X               ${PYTHON_PKGNAMEPREFIX}psycopg2>=2.0.8:databases/py-psycopg2
X
XUSES=          python zip
XUSE_PYTHON=    distutils autoplist
XNO_ARCH=       yes
X
X.include <bsd.port.mk>
c970339a333087de71dd54e30a5932e5
exit

_______________________________________________
freebsd-python@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-python
To unsubscribe, send any mail to "freebsd-python-unsubscr...@freebsd.org"

Reply via email to