Comments (20)
It does look like the colorama module could be a fairly simple way to address this:
http://pypi.python.org/pypi/colorama
from cli.
Bummed to find this bug, colored output would be nice.
from cli.
This should be fixed now. Thanks for the tip for colorama
, it works very well. I've tested it on Python 2.7 under Windows 7 with PowerShell and cmd.exe.
It would be great if you could test it and provide feedback (I don't use Windows very often):
pip install -U https://github.com/jkbr/httpie/tarball/master
There is one remaining Windows-related issue (unicode in terminal #71).
from cli.
I've just tested with powershell, zsh & cmd.exe using Python 2.7 - seems to work perfectly. Thanks for the fix.
from cli.
Glad to hear that. Thanks for the feedback.
from cli.
I get the following warnings when running httpie under PyPy 1.6 :
path\to\colorama\win32.py:17: RuntimeWarning: C function without declared arguments called
STDOUT: windll.kernel32.GetStdHandle(STDOUT),
path\to\colorama\win32.py:18: RuntimeWarning: C function without declared arguments called
STDERR: windll.kernel32.GetStdHandle(STDERR),
path\to\colorama\win32.py:64: RuntimeWarning: C function without declared arguments called
handle, byref(csbi))
path\to\colorama\win32.py:70: RuntimeWarning: C function without declared arguments called
return windll.kernel32.SetConsoleTextAttribute(handle, attrs)
I think that this is caused by PyPy (see http://mail.python.org/pipermail/pypy-commit/2011-April/049781.html)
but I suspect that the code could be changed to avoid this warning.
EDIT: Nevermind, these warnings are coming from Colorama.
http://code.google.com/p/colorama/issues/detail?id=26
from cli.
I'm still getting this using ActivePython 3.2.2.3 I ran the update command you listed and am still getting the same output as before. Am I missing anything?
from cli.
@dethstryke What is the output of http --version
? If it says something else than 0.2.6dev
, then please try to uninstall the old version first and then install the dev one again:
pip uninstall httpie
pip install -U https://github.com/jkbr/httpie/tarball/master
from cli.
I'm sorry that I didn't notice this issue thread when making the pull request. Also when I named my fork, I didn't know that you have already included colorama in the project. However, the dev branch did not work for me. (http --version gives 0.2.6dev for me) As I mention in my pull request, I had to change the stdout writing to a single print statement to get it working.
As a proof, here's a screenshot showing installation from the dev branch (on the left) and then from my fork (on the right):
http://grab.by/eRsq
I also had to install 'requests' separately, because the one provided by pip didn't work on my system. But by installing requests directly from their git repo worked flawesly.
I'm totally newbie with python, pip and colorama, and quite newbie also with github, so I'm sorry if this is just some Stupid User Error. But I still think that there is something wrong with outputting to the cmd.exe window, and my pull request seems to fix it.
from cli.
At a quick glance it would seem that a simple 'print output' (without any explicit encoding being done) works nicely on both Windows and OS X. I just want to understand the details involved - what would break if we were to remove the check for stdout.buffer and/or the encoding parts?
from cli.
@mieky Encoding the output ensures that unicode characters (like ě
, not colors) are displayed correctly on the terminal. The way it's done now seems to work well under OS X and Linux on all the supported Pythons, but on Windows it's still displayed incorrectly (#71).
The color problem that some people are still seing on Windows is most likely caused by the fact that colorama
is unable to process the output on some configurations (due to the way it's being written/encoded for OSX/Linux).
So, @cido's patch seems to solve the occasional color-related problems on Windows, but the output still needs to be encoded (somehow) to ensure that unicode works.
It's quite tricky to solve it universally. Any help appreciated.
from cli.
@jkbr Is there any changes I need to make to my win cmd.exe to prettify the output? Since I've installed 0.2.6-dev and still I get escape codes..
from cli.
Please try the current master:
pip install -U https://github.com/jkbr/httpie/tarball/master
from cli.
@jkbr Thank you, that worked.
from cli.
This seems to be fixed in 0.2.6
. Please feel free to reopen this issue if the problem persists.
from cli.
Thanks
pip install --upgrade httpie
from cli.
I'm not sure if there was a regression of if there is some problem with my local terminal, but the most recent version is showing this behavior for me.
python --version
Python 3.4.3http --version
0.9.2
←[0mhttp httpie.org
←[38;5;33mHTTP←[39m←[38;5;245m/←[39m←[38;5;37m1.1←[39m←[38;5;245m ←[39m←[38;5;37m302←[39m←[38;5;245m ←[39m←[38;5;136mFound←[39m
←[38;5;245mConnection←[39m←[38;5;245m:←[39m←[38;5;245m ←[39m←[38;5;37mclose←[39m
←[38;5;245mContent-Length←[39m←[38;5;245m:←[39m←[38;5;245m ←[39m←[38;5;37m292←[39m
[...]
from cli.
I just installed this on windows and am having the same issue as @mykwillis, but only in powershell. If I use httpie in the regular cmd prompt it looks fine.
Windows 7
python 2.7.10
httpie 0.9.2
from cli.
I notice that if I
pip install colorama==0.3.2
as opposed to using the latest colorama (0.3.3), then I don't get the control characters in the output.
It's not in color, but at least it's not garbled.
So this is likely something to do with a change in colorama between 0.3.2 and 0.3.3
from cli.
Just downgraded colorama to 0.3.2 based on @mykwillis suggestion and powershell output looks much better now. Thanks for the advice!
from cli.
Related Issues (20)
- Add support for HTTP/2, HTTP/3, System CA, OCSP Revocation HOT 3
- Support for team collaboration/sync HOT 3
- Average speed is reported incorrectly for resumed downloads HOT 1
- How to remove DEFAULT_UA? HOT 1
- Default to localhost HOT 2
- Allow XDG_CONFIG_HOME usage also on Windows
- More statuses support HOT 1
- Unable to install httpie via Chocolatey HOT 14
- [macOS] Lag when piping stdout HOT 5
- Display a warning for using option --ignore-stdin when request fails with content present in stdin
- Request is fired to packages.httpie.io on every invocation of `http` HOT 1
- How to post an empty string as a data field? HOT 2
- werkzeug compatibility
- Docs: Ubuntu/Debian installation script gives error
- Does not work with a small easy peasy sample 'http -f requests.http' HOT 4
- Add shortcut to --verify=no
- Default headers by domain
- Add support for OAuth2 authentication
- Can't install a plugin because cannot invoke pip
- HTTPS_PROXY not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.