Brenda, The most usual methods are:
1. Having all of the methods that are impacted in one module and 2. Having pyinstaller have a different variant of that file to the EC2 or 3. Using if hasattr(sys, “frozen”) to detect if you are running from the installer or EC2 at the moment or 4. Using sys.platform to see where you are running 5. Using environment variables on one/both, (possibly with fall-back values), or 6. Having a config file (different initial config supplied on each platform 7. Trying the values that definitely won’t work if you are on one platform and then falling back to what will work on the other or both. 8. See https://pyinstaller.readthedocs.io/en/v3.3.1/runtime-information.html for some other possibilities. Steve Barnes From: Brenda Bell<mailto:[email protected]> Sent: 19 October 2020 09:47 To: PyInstaller<mailto:[email protected]> Subject: [PyInstaller] Code compatibility I have a simple HTTP server written in python. I have it running on an EC2 instance where it's publicly available. After several of my users expressed an interest in being able to run the app locally, I decided to use pyinstaller to package and distribute. I was able to make it work, but now I'm faced with a situation where the code as written will either work from a pyinstaller binary or from my EC2 instance, but not both. For instance, I had to change the way I was getting paths for my data files. In pyinstaller, I'm using os.path.join(os.path.dirname(sys.executable), 'logging.conf'), but my EC2 deployment finds files by the path of the loaded module. The other difference is the destination for my log files (/tmp for the pyinstaller executable and /var/log for EC2). Would love to hear suggestions and/or best practices for doing this sort of thing. I really don't want to run the pyinstaller executable on my EC2 instance. -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/b873f1b4-0b29-4585-931b-8b5ffc49418cn%40googlegroups.com<https://groups.google.com/d/msgid/pyinstaller/b873f1b4-0b29-4585-931b-8b5ffc49418cn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/VI1PR03MB4479BD37E0731D1E88844C679B1E0%40VI1PR03MB4479.eurprd03.prod.outlook.com.
