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.

Allow readline.__file__ to be missing

See original GitHub issue

See indygreg/PyOxidizer#69 for more info about why, but the tl;dr version is __file__ is an optional attribute and should not be relied upon.

Currently cmd2 fails under PyOxidizer with:

  File "cmd2", line 15, in <module>
  File "cmd2.cmd2", line 56, in <module>
  File "cmd2.rl_utils", line 120, in <module>
AttributeError: module 'readline' has no attribute '__file__'

If sys.oxidized is set, and readline is imported (and isnt libedit), then any symbols needed are in the binary, if that is helpful.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kmvanbruntcommented, Nov 11, 2019

@jayvdb Here are the symbols we use from the readline.so file.

  • rl_basic_quote_characters
  • rl_display_match_list
  • rl_forced_update_display
  • rl_display_fixed
  • rl_point
  • rl_set_prompt
0reactions
tleonhardtcommented, Nov 17, 2019

@kmvanbrunt If we do this, I think we should do it in a fairly generic and robust fashion where there is a degraded mode in which we have access to the normal Python readline package functionality but do not have access to the extended functionality for which we are using ctypes to directly call functions in the readline dynamic library which are not wrapped by Python’s readline package. There should also be a good warning message printed in yellow upon startup of a cmd2 application functioning in this degraded mode notifying the user that this is happening. Moreover, the Sphinx docs should be updated to explain what features are not available in this degraded mode. This degraded mode shouldn’t be exclusive to PyOxidizer.

We may also wish to submit a feature request and/or PR to CPython for wrapping the missing functionality which is necessitating our usage of ctypes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

First line of the file is missing while reading - Stack Overflow
this iterates on the lines of the file, and inside the loop you read the whole file! The fact that the first line...
Read more >
Reading file data with PowerShell - SQLShack
The ReadLine() method reads the current line of the file, which in this case is the first line. Since we told the StreamReader...
Read more >
The Missing Readline Primer - zwischenzugs
First you're going to see what bash looks like without readline. ... That's because bash normally has an 'autocomplete' function that allows you ......
Read more >
How To Work with Files Using Streams in Node.js - DigitalOcean
Streams are an efficient way to handle files in Node.js. In this tutorial, you'll create a command-line program, and then use it with ......
Read more >
Read a file line by line - Rosetta Code
Read a file one line at a time, as opposed to reading the entire file at once. Related tasks Read a file character...
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