Closed wzuo closed 6 years ago
Build passing :)
Seems like the usual suspects needed changing. Thanks for finding them all!
I'd like to see the 2-vs-3 code collected into one place though; I don't like the Python version logic interspersed with the image handling logic. Perhaps a pycompat
module which contains functions that encapsulate all of that logic.
Or, even better: if everything we need is satisfiable by six, we mimic that API (or lift what we need (and reproduce the license)).
Changed to use six library :smile:
This looks good to me. Can you merge and do a release to make it pip installable?
Could you please finally merge it? It is annyoing to install Flask-Images without pip support :(
Looks good and it is already time to be py3 friendly. :+1:
I do appreciate the enthusiasm from everyone, but I disagree that it looks good. There is at least one regression (the HTTPError
handling).
I've rebased/squashed these into a single commit on the current master, at 85f6730 (the py3
branch).
I do not have the time to comb through this right now, especially since I would like to add some more tests to be able to catch that regression automatically. It will be at least 2 weeks before I can think about doing it. Even then... I have "real" work to do to pay the bills, you know?
Until then, if you want to use @wzuo's code as-is, you can pip install -e git+https://github.com/wzuo/Flask-Images.git#egg=Flask-Images
Could you please write how to reproduce that HTTPError
regression? I can look on fixing it
It is just missing an import of the right exception class.
Really, I'm fighting the pile-on of :+1: that would pressure me to immediately merge and release something that isn't thoroughly tested (which is my own fault, but this isn't much more than a personal project for my own sites).
Oh, and you can trigger it by requesting an image from something that will return an error code. https://httpbin.org/status/418 (etc.) would do wonderfully for that.
Am I missing something? I'm using python 3.4.0 in a virtualenv and I'm still getting ImportError: No module named 'cStringIO'
with from flask.ext.images import Images
it is removed in my branch, do you my branch? master does not support py3 afaik
@wzuo Yea I've got it from pip install -e git+https://github.com/wzuo/Flask-Images.git#egg=Flask-Images
. Think this is your branch. It works. thank you for your time
No documented way to use Flask-Image with Python 3 ?
Can't install the branch:
pip install -e git+https://github.com/wzuo/Flask-Images.git#egg=Flask-Images Obtaining Flask-Images from git+https://github.com/wzuo/Flask-Images.git#egg=Flask-Images Updating ./src/flask-images clone git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists. fatal: clone of 'git@github.com:mitsuhiko/flask-sphinx-themes.git' into submodule path '.../src/flask-images/docs/_themes' failed Failed to clone 'docs/_themes'. Retry scheduled git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
@emmanuelito I'm installing it via Dockerfile this way:
(stat /tmp/Flask-Images || git clone --depth 1 https://github.com/wzuo/Flask-Images /tmp/Flask-Images) && pip install -e /tmp/Flask-Images
If you don't use Docker then you need to clone and pip install from directory. I've been struggling with installing from pip directly via git, so I decided to make workaround. It works perfectly for my projects, even that it's 3 years old PR.
@wzuo Hi, I had a problem with the wrong build of a link to the picture. The links looked something like this:
/image.jpg?v=WzdUWw&w=480&s=b'PKgfqQAtQuvQseN6-gErB3tRjtM'
The whole problem in the s
parameter, looks like the bytes are converted incorrectly into a string.
I fixed this problem in my commit https://github.com/ovionlogis/Flask-Images/commit/9821feff51c84cae3176f3c4ab30255da85fcd49
Welp... I finally fixed the issues in the tests, released as 3.0.0, THEN read this through again and saw the HTTPError, wrote a test, and am waiting on 3.0.1 to pass CI.
"Official" Python3 support has landed.
Added support for Python 3 - works with 3.4.0 without any problem :)