How to Solve NameError: name 'StringIO' is not defined

Solution: Import the 'StringIO' module

# Add the following line to the top of your code
import StringIO

 

For more information:
Python StringIO