Is there any exp_internal equivalent in Pexpect - expect

I have recently started with pexpect and trying to learn it through the analogy with Tcl/Expect. Since I am come from the Tcl/Expect background, I believe there must be something like "exp_internal".
Can someone let me know what is equivalent of "exp_internal" of Tcl/Expect in pexpect terminology.
PS: exp_internal in Tcl/Expect prints all the log messages produced by the internal regex engine. It clearly shows what was the buffer received by the expect and what regular expression it matched or did't match.
EDIT
No answer seems to have existed back when the question was posted. I will just try to edit the question with hope that there now is an answer.

There is no such feature in pexpect

Related

What does (#)/[some_folder] mean at the beginning of that Shell script example?

I have no serious tech background, just know some Python basics. Became interested in Flask, read the Flask tutorial, saw that Flask requires setting some environment variables. Didn't know what that is, this led me to Linux and now I'm sort of addicted to that Linux Bible, I have the 9th edition. Normally man pages + Google always have answers for me. Not this time.
So there's an example backup script on p. 168, the second line right after the shebang line is:
# (#)/my_backup
The /my_backup part does not show up anywhere in the example script again and I get that this is commented out but it bugs me that the (#) part looks like being meaningful and I can't find any information on this. Searching the bash man pages only has unrelated results and Google wasn't helpful either.
Can anyone explain to me why this line is in the example script? I understand all of the script except the reason why the 2nd line looks how it looks. Have I overlooked something important while reading the book?

How to get started posting a question with Stack Overflow?

I know this is going to sound extremely stupid but I honestly cannot figure out how to post a question I have here for a program I am trying to make.
Whenever I paste my code into the code section this website tells me I have not formatted correctly. I triple check everything and it is all perfectly formatted. It is strange though because my code ends up being halfway into the place where I am suppose to describe the issue. So I am definitely doing this wrong.
Would somebody please walk me through a simple tutorial so I can finally ask my questions?
Honor to help you, I think you can first learn how to use markdown.
And this is two useful tutorial I read when I am learning.
Perfect question : WRITING THE PERFECT QUESTION
Use Markdown effectively : Markdown Getting Started
As for the display of code you mention above, you can use triple ``` to surround the code like this
import math
print('hello world')

How to reference and run a python document from the python interpreter

I just want to be able to run a python script from the interpreter, so that I can work on my changes to my script in notepad or other editor, save, and then interactively test changed code in the python interpreter.
Also, IDLE is not a solution. I'm operating on a government computer that is blocking the port it uses to communicate interaction between console and module.
To clear up any confusion, here's a demonstration of what I'm trying to do:
So, how do I do it?
EDIT:
Okay so I found a statement that does what I want. exec(open('dir').read()). The problem I think is that the directory I want to refer to contains periods. But I'm sure this will work, because open('dir').read() produces a string of the contents of a document specified, as long as I reference the likes of C:\myTest.py, and exec() obviously runs strings as input. So how can I reference files from the location I want?
Okay so the problem seems to be that Windows addresses often contain what python sees as 'unicode exits'. I'm not sure what they do or how they work, but I know they start with \ and are followed by a single letter and that there are enough of them to use up half the alphabet. There are a few solutions but only one is worth a damn for this application. I came across an operator that can be used in conjunction with strings, similarly to how + can be used to concatenate multiple strings, it seems r or R if you prefer (interestingly), can be used immediately before a string to tell the interpreter to take the string 'literally' as a string, and nothing else.
One would think that the quotes would be enough to express this, but they aren't and I'll probably eventually find out why. But for now, here's the answer to my question. I hope someone else finds it useful:
In plain text: >>> exec(open(R'C:\Users\First.Last\Desktop\myScript.py').read())

Python syntax error with "else"

I am using IDLE and Python 2.7. I am new to python and programming in general so sorry if this is extremely newbish, which it probably is.
Anyway, I'm following along and taking notes with python video and I was using IDLE and I keep getting this syntax error http://i.imgur.com/9urr4IW.png . I tried moving "else:" back to see if that was the problem but that didn't help. Just giving me a hint would help lol, thanks.
White space is significant in loops and if-else in python, I believe you wanted something like
if sister_age > brother_age:
print("Sister is older")
else:
print("Brother is older")
I solve your problem and solution is very simple...you just have to start the else part from the start of IDLE like i have done you will get your desirable output .

Is it possible to add multiple commands to the readline .inputrc file?

I'm trying to configure my Terminal and I would like to insert #{} at one key-stroke. This works with the following code
# .inputrc
"\e\"": "#{}"
But I also want the cursor to end up inside the braces. How can I do this? The following doesn't work.
# .inputrc
"\e\"": "#{}": backward-char
Try:
"\e\"": "#{}\e[D"
My immediate way to fix your overall goal (not really answering your question, but hopefully helping you anyway): write a bash alias or function for it. grev() perhaps, or something similar - at least, this is what I would do were I in your situation.
I am interested to see if what you originally asked is possible, however, so voting up your question in hopes that you can get a 'real answer'!

Resources