Note that there are some explanatory texts on larger screens.

plurals
  1. POdelete *.pyc
    primarykey
    data
    text
    <p>I have three modules as:</p> <p><strong><code>one.py</code>:</strong></p> <pre><code>def abc(): print "Heeeeeeeeeeeiiiiiioooooooooo" </code></pre> <p><strong><code>two.py</code>:</strong></p> <pre><code>import one def defg(): one.abc() </code></pre> <p><strong><code>three.py</code>:</strong></p> <pre><code>import os from time import sleep import two two.defg() sleep(20) directory = os.listdir('.') for filename in directory: if filename[-3:] == 'pyc': print '- ' + filename os.remove(filename) </code></pre> <p>I have three doubts.<strong>Kindly help me</strong>.</p> <p>When i run <code>three.py</code> for the first time <code>one.pyc</code> and <code>two.pyc</code> will be created. I can see it since i gave 20 sec delay. After executing the statement <code>os.remove(filename)</code>, they gets removed. Until here its fine.</p> <p>Again without closing the IDLE as well as script i ran <code>three.py</code>. This time no <code>.pyc</code> file was created. <strong>Why is this so</strong> ?</p> <p>If I close IDLE as well as the script, <code>.pyc</code> will be created as before.</p> <p><strong>Why the compiled code is not getting created again and agin ?</strong></p> <p>Also,if I make a change in <code>one.py</code> it will not be shown if I run without closing the shells. <strong>I need a solution for this also.</strong></p> <p>Third doubt is <strong>if the compiled code is getting deleted first time itself then how the second run gives the same result without <code>.pyc</code>?</strong></p> <p>Hoping for a solution...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload