Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

python - Twill causing print() not to show

I'm trying to use Twill with Jupyter/Python. However if I use Print() after I've imported Twill eg.

from twill.commands import go, showforms, formclear, fv, submit, show

print("hi") 

it won't print anything.

Is this normal behaviour?

This happens on google colan and jupyterLab

question from:https://stackoverflow.com/questions/65713868/twill-causing-print-not-to-show

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is possible that your module has its own sys module which makes troubles with Jupyter upon import.

Try this:

from twill.commands import go, showforms, formclear, fv, submit, show
import sys

sys.stdout = stdout

print ('hi')

Otherwise I'd just recommend never using those online notebooks which are, to my opinion, essentially limiting because of unexpected behaviors not easy to solve due to a lack of documentation relative to main Python.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...