Comments (14)
Thanks for the bug report. What is the howdoi
command you are running? I just tried the latest version from master and it appears to be working:
$ python3 howdoi/howdoi.py format date bash
DATE=`date +%Y-%m-%d`
from howdoi.
It's happening with me, too - using the command "howdoi perl join", with python verson 3.2.3
from howdoi.
Aha. I am using Python 3.3. Let me see if I can install Python 3.2 and figure out what the issue is...
from howdoi.
I'm guessing this is the issue
Unicode literals causing invalid syntax
from howdoi.
I believe the following steps will fix the issue:
- Please change all instances of u"foo" to "foo"
- Put this at the top of the file:
from __future__ import unicode_literals
Please let me know if that works for you and I'll add it to the main codebase.
from howdoi.
And here is why I was not seeing an issue with Python 3.3 but you do in 3.2
http://www.python.org/dev/peps/pep-0414/
from howdoi.
Sorry, I should have mentioned originally that Python3.3 did work fine. With the changes suggested above it's working with Python3.2.
from howdoi.
Perfect. Thanks for your help! I'll check in the changes and do a point release
from howdoi.
When I added from __future__ import unicode_literals
I got the following error in Python2. Seems to be an issue with lxml (used by PyQuery)
$ python howdoi/howdoi.py get this to work in python3
Traceback (most recent call last):
File "howdoi/howdoi.py", line 168, in <module>
command_line_runner()
File "howdoi/howdoi.py", line 165, in command_line_runner
print(howdoi(args))
File "howdoi/howdoi.py", line 142, in howdoi
return get_instructions(args) or 'Sorry, couldn\'t find any help with that topic\n'
File "howdoi/howdoi.py", line 120, in get_instructions
links = get_links(args['query'])
File "howdoi/howdoi.py", line 48, in get_links
return [a.attrib['href'] for a in html('.l')]
File "lxml.etree.pyx", line 2261, in lxml.etree._Attrib.__getitem__ (src/lxml/lxml.etree.c:53908)
KeyError: u'href'
However it turns out I don't need Unicode strings at all so I just removed all the references to u'foo'
. I've merged the changes into the master branch and have updated pypi. Please let me know if you see any other issues.
from howdoi.
It seems Python 2.7 do need u'...', otherwise, you will get UnicodeEncodeError.
Try this query: howdoi.py -n3 python unittest
I got:
Traceback (most recent call last):
File "howdoi.py", line 166, in
command_line_runner()
File "howdoi.py", line 163, in command_line_runner
print(howdoi(args))
File "howdoi.py", line 140, in howdoi
return get_instructions(args) or 'Sorry, couldn't find any help with that topic\n'
File "howdoi.py", line 131, in get_instructions
answer = ANSWER_HEADER.format(current_position, answer)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 350: ordinal not in range(128)
from howdoi.
Cannot reproduce previous comment with Python 2.7 and howdoi 1.1.2
from howdoi.
I'm having difficulty as well. Would to please provide an example that
breaks?
On Mar 22, 2013 10:44 AM, "kensington" [email protected] wrote:
Cannot reproduce previous comment with Python 2.7 and howdoi 1.1.2
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/52#issuecomment-15307558
.
from howdoi.
Here is the query and I am using latest git copy of howdoi.py. Not sure the version number.
howdoi -n 3 python unittest
from howdoi.
Thanks for pointing out the issue, @dnatag. I've submitted a fix to the master branch as well as a test for this error.
Please let me know if you run into any more issues.
from howdoi.
Related Issues (20)
- Can't print non-ascii text to windows terminal HOT 3
- pickle.UnpicklingError: the STRING opcode argument must be quoted HOT 4
- Add flag to enable paging / choose pager HOT 3
- Is the tracking parameter t=hj in the duckduckgo URL intentional? HOT 7
- Function `_format_url_to_filename` only used in tests HOT 2
- Error in command `howdoi print in python` HOT 3
- Add checks when it comes to something like `range` HOT 2
- Not installable in python3.5 HOT 3
- Change pull request template "Pull request Type" to checklist HOT 2
- Add page cache to .gitignore HOT 1
- fresh install, stuck at 1.1.9 HOT 4
- Fetch Bing- Chat-GPT HOT 2
- Add method to detect symbols like +, /, etc. in the queries HOT 7
- ERROR: Sorry, couldn't find any help with that topic (use --explain to learn why) HOT 8
- GPT Implementation?
- 403 forbiddeb HOT 2
- Questions about Copilot + Open Source Software Hierarchy
- Coloured output not visible in light terminal window
- Add bash / zsh / fish shell completions
- Add extension to Open VSX registry HOT 1
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 howdoi.