utils.py 611 Bytes
Newer Older
Marco Govoni's avatar
Marco Govoni committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python3

from __future__ import print_function
from os import mkdir 
import sys

#############
# INTERFACE #
#############

def my_mkdir(*args, **kwargs):
    #
    path = args[0]
    #
    try:
        mkdir(path)
    except OSError:
        #print (f"Creation of the directory {path} failed")
        pass
    else:
        #print (f"Successfully created the directory {path} ")
        pass
    sys.stdout.flush()

########
# TEST #
########

def test() :
    #
    dirname = "./wstat.save"
    #
    my_mkdir(dirname)

if __name__ == "__main__":
    # execute only if run as a script
    test()