Won't write output to logfile on Unix/Linux but does on Windows
<p>I have the following code, it will create the logfile on both platforms, but it will only write the output to the windows logfile.</p>

<pre><code>import os                       

logdir = os.getenv("logs")                          
logfile = 'script_list.log'
path = (raw_input("Enter dir: "))                                   
if os.name == "posix":
    log = open("//".join([logdir,logfile]), 'w')                        
else:
    log = open("\\".join([logdir,logfile]), 'w')                        
for dirpath, dirname, filenames in os.walk(path):           
    for filename in [f for f in filenames]: 
        if os.name == "posix":
            log.write(str(dirpath)+ "//" + str(filename) + "\n")    
        else:
            log.write(str(dirpath)+ "\\" + str(filename) + "\n")    
print '\nYour logfile ' + logdir + '\\' + logfile + ' has been created'
</code></pre>

<p>Thanks in advance</p>
