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 httpie.
Bummed to find this bug, colored output would be nice.
from httpie.
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 httpie.
I've just tested with powershell, zsh & cmd.exe using Python 2.7 - seems to work perfectly. Thanks for the fix.
from httpie.
Glad to hear that. Thanks for the feedback.
from httpie.
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 httpie.
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 httpie.
@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 httpie.
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 httpie.
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 httpie.
@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 httpie.
@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 httpie.
Please try the current master:
pip install -U https://github.com/jkbr/httpie/tarball/master
from httpie.
@jkbr Thank you, that worked.
from httpie.
This seems to be fixed in 0.2.6
. Please feel free to reopen this issue if the problem persists.
from httpie.
Thanks
pip install --upgrade httpie
from httpie.
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 httpie.
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 httpie.
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 httpie.
Just downgraded colorama to 0.3.2 based on @mykwillis suggestion and powershell output looks much better now. Thanks for the advice!
from httpie.
Related Issues (20)
- Trim trailing empty lines from CLI output HOT 1
- Cryptographic API Misuse Vulnerability : Missing SSL Certificate Validation HOT 1
- Filter response keys before print result to the screen
- HTTPie could be lead to believe data was passed in stdin when it was not HOT 1
- httpie -d does not work with gzip compressed content
- Add cli option to generate scriptable or compilable code, or a native executable, that performs the command wherein the option was included
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today:
- I got [reports](https://github.com/RageAgainstThePixel/OpenAI-DotNet/issues/236) that this started happening today:
- ## Acceptance Criteria
- it is not possible install for arm linux HOT 3
- Please add support for Mise
- conda-forge lists __win as a MatchSpec dependency for httpie=2.2.0 preventing installation on linux-64 HOT 1
- Failed to use {{key}}={{value}} for nested JSON HOT 1
- Online doc error HOT 3
- Ability to define a custom default user-agent in config.json
- Add .netrc support when using --auth-type bearer
- unable to CONTRIBUTING
- ### Summary
- server HOT 1
- CLI help doesn't show how to launch in a browser!
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 httpie.