I am writing a simple code that runs a batch file and opening of an excel sheet to store some data. I have given the location of the file on my computer. I want to use "pyinstaller" to create an executable so that I can run in other computers as well. Where should I put the *.xlsx and *.bat file in the new computer so that it works, and also should I change the file path in my program? If so how?
filepath = r"F:\project\printingdatabase.xlsx"
wb = load_workbook(filepath)
subprocess.call(r"F:\project\batfile\tester.bat")
# This gets you the dir of the current script in an os-independent way, for example
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# This appends a subdir "sub-dir" to the base path, in an os-independent way
os.path.join(BASE_DIR, 'sub-dir')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.