I have python 3.6. I want to execute python file named 'operation.py' from another python file named 'run.py'.
In operation.py
I do from cStringIO import StringIO
. PyCharm shows me a warning that there is no module named StringIO. I know that since python3 I have to import StringIO module from io. However, when I use this importation, the functions of this module are no longer work.
Although there is a warning in from cStringIO import StringIO
, the code still works (I know this import really works because I tried to make it a comment and it couldn't run). The problem is that when I try to run this file by the 'run.py' file, it can't run and prints the following message: ModuleNotFoundError: No module named 'cStringIO'
.
I tried to use this Unresolved reference issue in PyCharm but it didn't help.
Why does 'operation.py' run though the warning, but 'run.py' does not? How can I solve this?
operation.py:
from cStringIO import StringIO
str_io = StringIO()
g = Generator(str_io, False)
# There is a full code here...
run.py:
import operation
def main():
operation
The operation.py
has a warning but runs well, run.py has a fail.