[Tutor] some things work in IDLE but not a command prompt and vice versa
j.m.rice at talktalk.net
Thu Apr 24 01:14:35 CEST 2014
Experimenting with pickling...
file1 = open('first.txt','r')
contents = file1.read()
file2 = open('pickle.dat','wb')
contents = ''
file3 = open('pickle.dat','rb')
contents = pickle.load(file3)
input('\nPress Enter to finish')
This works as expected when run under the IDLE.
first.txt is just a small text file.
If I run from a command prompt, however, I get
How are you?
Traceback (most recent call last):
File "pickle.py", line 1, in <module>
File "C:\Users\Martin\Documents\College\python\pickle.py", line 11,
AttributeError: 'module' object has no attribute 'dump'
Get similar problem on College computers as well as at home. Python
3.3.3 Windows 7 Professional SP1
I get the opposite problem with themsvcrt.getch() function. It works OK
when run from a command prompt, but under IDLE it returns immediately
without waiting for a key-press, with value b'\xff'. Is this just a
feature of the IDLE?
This email is free from viruses and malware because avast! Antivirus protection is active.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor