0

I am relatively new at this, so I ask for a little patience.

I have been working on a program that collects information from 3 separate excel files and then writes that information on a word document. When I process it through my IDE, it works with no issues. However, when I use pyinstaller to make an executable then try to run it, the prompt opens and closes with no real change. The files that would normally be created are not created. Is there something about pysinstaller I am missing? I want to show you the code, but I have no clue which snippet would actually tell you what the problem is.

  • Are the file locations hard-coded? Maybe the files are not located where you think they are. Are you running this on a system where Word and Excel are installed? – Tim Roberts Oct 11 '22 at 03:27
  • `path=os.path.dirname(__file__)` `full_path=os.path.join(path,file_name)` `print(full_path)` `with open(full_path,"r") as datafile:'''` I use this in a custom function with the file_name provided to get the locations of the file. All of the excel docs are located in the same file on the desktop. Is it because I am trying to use modules like docx and csv? – Cody Bijeaux Oct 11 '22 at 03:33
  • 2
    @CodyBijeaux That is the problem... when you use `__file__` in pyinstaller, it uses the file of the temporary directory it creates.... not the executable file itself. – Alexander Oct 11 '22 at 04:04
  • 1
    @Alexander that sounds like something that ought to be covered in an existing question. Unfortunately, I have no experience with pyinstaller, so I don't have anything like that saved, and it sounds rather painful to search for. – Karl Knechtel Oct 11 '22 at 04:11
  • 1
    Actually, is https://stackoverflow.com/questions/50959340/pyinstaller-exes-file-refers-to-a-py-file good enough? – Karl Knechtel Oct 11 '22 at 04:12
  • @KarlKnechtel Yes that actually covers it pretty well. Plus it links to the documentation. – Alexander Oct 11 '22 at 04:13
  • I will try that. Shouldn't it be displaying some sort of error though? When I run it through cmd, it just starts and closes the program. Is that normal? – Cody Bijeaux Oct 11 '22 at 22:40

0 Answers0