Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Issue with speedtest module in Pythonista - AttributeError: 'StdoutCatcher' object has no attribute 'fileno'
-
Hello,
I hope you're all doing well.
I've been working on a project in the Pythonista app on my iPhone, and I've run into an issue while trying to use the speedtest module. I'm hoping someone here might be able to provide some insights or guidance on how to resolve this problem.Here's the background and the issue I'm facing:
I'm using the Pythonista app on my iPhone to run a script that tests and records internet speed over time.
The script imports the speedtest module to perform speed tests and then saves the results to a CSV file.
When running the script, I encounter the following error message:Traceback (most recent call last):
File "path/to/my/script.py", line 3, in <module>
import speedtest
File "path/to/speedtest.py", line 179, in <module>
_py3_utf8_stdout = _Py3Utf8Output(sys.stdout)
File "path/to/speedtest.py", line 166, in init
buf = FileIO(f.fileno(), 'w')
AttributeError: 'StdoutCatcher' object has no attribute 'fileno'
I've checked for potential conflicts, ensured that I'm using Python 3, and updated the speedtest-cli module to the latest version, but the issue persists.The line of code that seems to be causing the error is simply the library import statement.
import speedtestHas anyone else encountered a similar problem when using the speedtest module in Pythonista? I would really appreciate your help :)
-
The
StdoutCatcher
is defined at https://docs.python.org/3/faq/extending.html#how-do-i-catch-the-output-from-pyerr-print-or-anything-that-prints-to-stdout-stderr -
@ccc Hi! That was really helpful, thanks :)