<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Experimenting with pickling...<br>
    <br>
    <small><font face="Courier New, Courier, monospace">import pickle<br>
        <br>
        file1 = open('first.txt','r')<br>
        contents = file1.read()<br>
        file1.close()<br>
        <br>
        print(contents)<br>
        <br>
        file2 = open('pickle.dat','wb')<br>
        pickle.dump(contents,file2,True)<br>
        file2.close()<br>
        <br>
        contents = ''<br>
        <br>
        file3 = open('pickle.dat','rb')<br>
        contents = pickle.load(file3)<br>
        print(contents)<br>
        input('\nPress Enter to finish')<br>
      </font></small><br>
    This works as expected when run under the IDLE.<br>
    first.txt is just a small text file.<br>
    <br>
    If I run from a command prompt, however, I get<br>
    <br>
    C:\Users\Martin\Documents\College\python>python pickle.py<br>
    Hello!<br>
    How are you?<br>
    123<br>
    Traceback (most recent call last):<br>
      File "pickle.py", line 1, in <module><br>
        import pickle<br>
      File "C:\Users\Martin\Documents\College\python\pickle.py", line
    11, in <module<br>
    ><br>
        pickle.dump(contents,file2,True)<br>
    AttributeError: 'module' object has no attribute 'dump'<br>
    <br>
    C:\Users\Martin\Documents\College\python><br>
    <br>
    Get similar problem on College computers as well as at home.  Python
    3.3.3  Windows 7 Professional SP1<br>
    <br>
    I get the opposite problem with the<small><font face="Courier New,
        Courier, monospace"> msvcrt.getch()</font></small> 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?<br>
    <br>
    Martin<br>
  
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="http://www.avast.com/">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                This email is free from viruses and malware because <a href="http://www.avast.com/">avast! Antivirus</a> protection is active.
                        </p>
                </td>
        </tr>
</table>
<br />
</body>
</html>