[Tutor] Problem with os.system

Albert-Jan Roskam fomcl at yahoo.com
Fri Mar 1 15:11:18 CET 2013


>I was using python for some application which used to create directories and also to run some exes using the os.system command from a program.py file which was working fine. For some reasons I got my system formatted and got the windows 7 installed.

> 
>Now again I installed python and tried running the same program.py.  The program executes successfully with no errors but my directory and exes are not getting invoked.
> 
>I tried creating the below sample program and executed it
> 
>#!/usr/bin/env python
>import os
>global name_wo_ext
>name_wo_ext = "d:\\fun"
>os.system("mkdir %s" % (name_wo_ext))

Hello, not sure if it solves things, but are you aware of os.mkdir? And do you have sufficient rights to create a dir where you want to create it?


>>> help(os.mkdir)
Help on built-in function mkdir in module nt:

mkdir(...)
    mkdir(path [, mode=0777])
    
    Create a directory.

>>> 



More information about the Tutor mailing list