question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Examples seem to be out of date

See original GitHub issue

Hi, I am trying to use examples in the documentation, but many of them seem to be out of date. For example:

from prompt_toolkit.shortcuts import prompt
from prompt_toolkit.styles import Style

style = Style.from_dict({
    # User input.
    '':          '#ff0066',

    # Prompt.
    'username': '#884444',
    'at':       '#00aa00',
    'colon':    '#00aa00',
    'pound':    '#00aa00',
    'host':     '#000088 bg:#aaaaff',
    'path':     '#884444 underline',
})

def get_prompt():
    return [
        ('class:username', 'john'),
        ('class:at',       '@'),
        ('class:host',     'localhost'),
        ('class:colon',    ':'),
        ('class:path',     '/user/john'),
        ('class:pound',    '# '),
    ]

text = prompt(get_prompt, style=style)

causes exception: “AttributeError: type object ‘Style’ has no attribute ‘from_dict’”. I had issues with most of the examples I tried so far, but had satisfaction following this article: 4 Python libraries for building great command-line user interfaces.

Am I missing something? Is it maybe because examples are not updated to version 2?

Best Regards

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
RobertoPrevatocommented, Jan 6, 2018

Maybe it would be best to mention this in the README. For example, explaining that, to try the latest examples before the release of version 2.0, one can use this command to install the package:

pip install https://github.com/jonathanslenders/python-prompt-toolkit/archive/2.0.zip

Instead of:

pip install prompt_toolkit
0reactions
hrchucommented, Jan 26, 2018

agree @RobertoPrevato

I encounter the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use out-of-date in a sentence
Example sentences with the word out-of-date. The most voted sentence example for out-of-date is The success of the restaurant ...
Read more >
Out of date in a sentence
60+3 sentence examples: 1. A passport that is out of date is invalid. 2. But it's out of date already. 3. That radio...
Read more >
Use out of date in a sentence - Bab.la
How to use "out of date" in a sentence? ; Finally, this report is · of date. ; But they are now ·...
Read more >
100 Synonyms & Antonyms of OUT-OF-DATE - Merriam-Webster
Synonyms for OUT-OF-DATE: obsolete, antiquated, archaic, outdated, medieval, dated, outmoded, prehistoric; Antonyms of OUT-OF-DATE: modern, current, new, ...
Read more >
25 English Expressions You Might Encounter (But Which Now ...
25 English Expressions You Might Encounter (But Which Now Seem Out Of Date) · 1. Cut to the chase · 2. Whoops-a-daisy ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found