Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCheri Nadell
2,954 PointsIn the 'Add An Entry' video, I get this error: TypeError: 'PseudoInputFile' for: data = sys.stdin().read().strip()
In the 'Add An Entry' video in Using Databases, when using the Python Shell, I got the following error:
TypeError: 'PseudoInputFile' object is not callable
for the line:
data = sys.stdin().read().strip()
By the way, everything worked great up until I added:
print("Enter you're entry. Press ctrl+d when finished.")
data = sys.stdin().read().strip()
if data:
if input('Save entry? [Yn] ').lower() != 'n':
Entry.create(content=data)
print("Saved successfully!")
and of course, 'the import sys'.
Can anyone please help me with correcting this problem so I can move on?
Thank you in advance.
[edit: formatting --cf]
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsThe error is a typo. stdin
is a module not a function or method so you don't include parens after it. Try:
data = sys.stdin.read().strip()
Cheri Nadell
2,954 PointsSometimes it's difficult to proofread your own work, you know? My code works great now. Thank you!