-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch.py
30 lines (24 loc) · 811 Bytes
/
search.py
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
import sys
import subprocess
import platform
import os
def main():
OS = platform.system()
# Change to the 'src' directory
if os.path.exists('src'):
os.chdir('src')
else:
print("The 'src' directory does not exist.")
sys.exit(1)
# Run the main.py script from the src folder
if OS == 'Windows':
print("\nDetected Windows Operating System. Running main.py from src folder...")
subprocess.run(['python', 'main.py'], check=True)
elif OS == 'Linux':
print(f"\nDetected {OS} Operating System. Running main.py from src folder...")
subprocess.run(['python3', 'main.py'], check=True)
else:
print(f"Unsupported Operating System: {OS}. Unable to run the script.")
sys.exit(1)
if __name__ == '__main__':
main()