A downloadable Executable Compiler for Windows

With this app, youll never even need to install Python in order to use AI made Code.

Excaliber pulls Victory from a Magik Block...

The reason compiled executables often fail to read files in their same directory is because, depending on how they are launched, their "current working directory" might default to the folder where the terminal was opened, or they might try to read from the temporary _MEIPASS folder where PyInstaller extracts its runtime files.

To fix this for any script you compile, we don't actually need to modify the target scripts themselves. Instead, we can make your compiler automatically generate a PyInstaller Runtime Hook.

A runtime hook is a tiny piece of Python code that PyInstaller injects to run before the main target script starts. By having the compiler generate a hook that explicitly tells the program to set its working directory to os.path.dirname(sys.executable) (the exact physical location of the .exe), your compiled gallery viewers will flawlessly find the images right next to them.

How this works:

  1. When your compiler triggers, it creates a temporary script called runtime_hook_chdir.py.
  2. It passes this file into PyInstaller as a --runtime-hook.
  3. PyInstaller integrates this hook into the final executable perfectly seamlessly. This means whenever anyone double-clicks the resulting .exe, the very first thing it will do is run os.chdir(os.path.dirname(sys.executable)).
  4. Your compiler then safely cleans up the temporary hook file right alongside the .spec and build folder.

This ensures that any relative paths (like os.listdir('.')) executed inside the gallery viewer will strictly point to the folder containing the .exe itself!

Normaly, when a Python app gets compiled with PyInstaller, __file__ gets pointed to a temporary hidden _MEIPASS folder that PyInstaller extracts to, so no matter how much you change the working directory, for me, CLJ.PY was always stubbornly looking inside that empty temporary extraction folder! To fix this universally so it works flawlessly for CLJ.PY (and any other scripts you compile), we use a much more aggressive approach than your "standard" compilers do. We can instruct your compiler to temporarily clone the target script and forcefully inject a "Magik Block" of code at the very top to rewrite __file__ to point to the actual .exe file before compiling it.

Why this guarantees it works (Probably):

Instead of trying to fight PyInstaller externally, your compiler now creates a temporary _temp_CLJ.py file, pastes that __file__ = sys.executable override line to the absolute very top of the code, runs PyInstaller on that instead, and then cleverly renames the resulting .exe back to just CLJ.exe while hiding its tracks.

Now, whenever CLJ.PY looks for os.path.abspath(__file__), the code evaluates __file__ as the literal physical .exe address, allowing CLJ.PY's folder scanning system to instantly lock on to the correct images right alongside it!

Published 2 days ago
StatusReleased
CategoryTool
PlatformsWindows
AuthorMaetraous
Tagsbhodi, code, compiler, executable, gemin8, python, satfur, unbound
AI DisclosureAI Assisted, Code, Graphics, Sounds, Text

Download

Download
Excaliber.exe 7.7 MB
Download
Excaliber.py 7.1 kB
Download
Excaliber.7z 7.8 MB

Install instructions

To create an executable file from a python script you must place Excaliber into a folder with your target python application, and double-click the compiler.

If the executable that Excaliber produces doesnt work then the backup solution is for you to run the python script directly(instead of the executable) to convert your working python code into a functional & complete EXE file; this technique has worked for me!