Last Updated on 2020-10-20 by Clay
Introduction
This is a record of the error message that I have encountered: When learning a sample code provided on the Internet, it was no problem for them to use the code to cut the picture and save it in the clipboard, but when I used their sample, it show the following error message:
ModuleNotFoundError: No module named 'cStringIO'
It looks like I lacked the cStringIO module, and finally I found the answer on StackOverflow.
The following simple record solution.
Solution
This problem is usually encountered when using the following code:
from cStringIO import StringIO
Output:
ModuleNotFoundError: No module named 'cStringIO'
The reason is actually very simple. The cString module is only available in Python 2.x. In Python 3.x, if you want to use StringIO, BytesIO and other modules, we can directly import io.
For example
from io import StringIO
You can try to confirm whether it can be executed normally
References
- https://stackoverflow.com/questions/28200366/python-3-x-importerror-no-module-named-cstringio
- https://github.com/Infinidat/infi.clickhouse_orm/issues/27