Isn't this all already done by
? (thanks @EricHedengren for correction below! ;)
OSErrors from the os package will do the error messaging ...
hjoon0510 I am working on learning Python myself but as to selecting the NAME. I import the "socket", then set a variable to hostname = socket.gethostname(). I can then call that variable to name my file or directory. Again I am trying to learn also so there may be a better way to do it but here is the code I am playing with to learn.
ps = platform.system()
sys.stdout = open("%s %s" % (hostname, (currentDT.strftime("%m%d%Y %H%M%S"))) + ".txt", "w+")
HDs = wmi.WMI()
print("Installed OS: " + ps + '\n' + "OS Version: " + pr + '\n' + "OS Build: " + build + '\n' +
for adapter in adapters:
Thank you very much..... keithweaver
if anybody facing issue while creating the folder, followed with an error message like this
please just duplicate with a backslash for the directory you want to create. Here I want to create a Temp folder in web_scrapper folder
You're right @gwangjinkim. Just switch mkdirs to makedirs and it's good to go.