3

I'm relatively new to Python, but I've searched for answers on this. My code is:

import urllib, http
import gspread
import datetime
import getpass
import sys
from http import cookiejar

pwd = getpass.getpass()

and then obviously a lot more, but it throws me an error right at line 8:

File "C:\Python33\lib\idlelib\PyShell.py", line 60, in idle_showwarning
    file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'"

I'm not sure if it matters, but this is what I'm using the pwd for:

payload = {
  'op': 'login-main',
  'SignonAccountNumber': '###',
  'SignonPassword': pwd
  }

Thanks for your help

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
J Wint
  • 31
  • 1
  • 2
  • 1
    possible duplicate of [How do I resolve 'NoneType' object has no attribute 'write' error with scikit-learn digits dataset?](http://stackoverflow.com/questions/17139658/how-do-i-resolve-nonetype-object-has-no-attribute-write-error-with-scikit-le) – Martijn Pieters Jul 08 '13 at 20:24
  • 2
    Have you tried executing your script directly from the command line rather than from idle? – ChrisProsser Jul 08 '13 at 20:31
  • It was an idle problem - thanks for your help. I have no idea how to 'upvote' your comments, though – J Wint Jul 09 '13 at 13:48
  • This bug was fixed sometime before 2.7.13 and 3.5.3, which are the earliest I have loaded to test on. – Terry Jan Reedy Jul 05 '17 at 22:02

1 Answers1

1

If you are using IDLE as your editor then your issue may be this bug: http://bugs.python.org/issue18030

In the bug report, the user gets around the issue by running IDLE with this command: python -m idlelib.idle

Twisted
  • 113
  • 2