File inventory_synchronisation.py changed (mode: 100644) (index 98c7b85..523ff69) |
... |
... |
def main(): |
27 |
27 |
reportpath = os.getcwd() + '/Report' |
reportpath = os.getcwd() + '/Report' |
28 |
28 |
uploadpath = os.getcwd() + '/Upload' |
uploadpath = os.getcwd() + '/Upload' |
29 |
29 |
configpath = os.getcwd() + '/config.txt' |
configpath = os.getcwd() + '/config.txt' |
|
30 |
|
|
|
31 |
|
print("\nCurrent directory : {0}\n".format(os.getcwd())) |
30 |
32 |
if( not( os.path.exists(reportpath) ) or not( os.path.exists(uploadpath) ) ): |
if( not( os.path.exists(reportpath) ) or not( os.path.exists(uploadpath) ) ): |
31 |
33 |
if(not(os.path.isfile(configpath))): |
if(not(os.path.isfile(configpath))): |
32 |
34 |
while(not(re.match(r'^(y|j)', use_current_dir[0].lower()) or re.match(r'^n',use_current_dir[0].lower()))): |
while(not(re.match(r'^(y|j)', use_current_dir[0].lower()) or re.match(r'^n',use_current_dir[0].lower()))): |
33 |
35 |
use_current_dir = input("Do you want to use the current directory, for the folders and config?") |
use_current_dir = input("Do you want to use the current directory, for the folders and config?") |
34 |
36 |
if(use_current_dir[0].lower() == 'y' or use_current_dir[0].lower() == 'j'): |
if(use_current_dir[0].lower() == 'y' or use_current_dir[0].lower() == 'j'): |
35 |
|
if( not os.path.exists(reportpath) ): |
|
|
37 |
|
if( not ( os.path.exists(reportpath ) or os.path.exists(uploadpath)) ): |
36 |
38 |
os.makedirs(reportpath) |
os.makedirs(reportpath) |
37 |
39 |
os.makedirs(uploadpath) |
os.makedirs(uploadpath) |
38 |
40 |
else: |
else: |
|
... |
... |
def main(): |
75 |
77 |
config.write( "upload_folder = {0};\n".format(uploadpath) ) |
config.write( "upload_folder = {0};\n".format(uploadpath) ) |
76 |
78 |
config.write( "report_folder = {0};\n".format(reportpath) ) |
config.write( "report_folder = {0};\n".format(reportpath) ) |
77 |
79 |
|
|
|
80 |
|
if(not(os.path.exists(uploadpath) or os.path.exists(reportpath))): |
|
81 |
|
newpath = askdirectory(title="Choose the directory for the folders") |
|
82 |
|
uploadpath = os.path.join(newpath, os.sep, 'Upload') |
|
83 |
|
reportpath = os.path.join(newpath, os.sep, 'Report') |
|
84 |
|
configpath = os.path.join(newpath, os.sep, 'Config.txt') |
|
85 |
|
with open(configpath , mode = 'w') as config: |
|
86 |
|
config.write( "#-Config file for the FBA Shipment Script;\n" ) |
|
87 |
|
config.write( "#= '#= marks the beginning of a comment', '= splits between name and value';\n" ) |
|
88 |
|
config.write( "#=location of upload and report folder;\n" ) |
|
89 |
|
config.write( "upload_folder = {0};\n".format(uploadpath) ) |
|
90 |
|
config.write( "report_folder = {0};\n".format(reportpath) ) |
|
91 |
|
|
78 |
92 |
|
|
79 |
93 |
# Ask the user if the task is to import received items at amazon or to |
# Ask the user if the task is to import received items at amazon or to |
80 |
94 |
line = "#" * 70 |
line = "#" * 70 |