sciter-sdk/pysciter

Force location of sciter binaries? (without PATH)

ethanpil opened this issue · 5 comments

I am trying to make a cross-platform application (Windows/Mac/Linux) and am repeatedly having issues with installation across platforms.

It's very difficult to reliably install a third party library into the correct place on these platforms. It would be wonderful if I can simply Freeze and package the application with PyInstaller

I cannot seem to be able to simply keep the binary libraries in the same folder as my .py project files and be correctly detected and loaded by pysciter. Is there any way I can force the system to find and use an internal sciter instead of having to push it to the user's PATH?

You can add the current directory to the PATH, as an option.

Thanks, I can confirm the following works on MacOS:

import sys,os
import sciter

sys.path.append(os.getcwd())

if __name__ == '__main__':
    frame = sciter.Window(ismain=True, uni_theme=True)
    frame.load_file("minimal.htm")
    frame.expand()
    frame.run_app()

I have only three files in the directory:
image

I tried the same thing on a Windows machine with the DLL but it did not work. I will play with it more and report back.

Just got to my Windows 10 PC. It did not work with the 64bit DLL, even though I am on a 64bit Windows install.

I guessed that I must have a 32bit Python install. Confirmed with this code, which will output 32 or 64...

import struct
truct.calcsize("P") * 8

Once I confirmed I am on a 32bit Python install, I swapped sciter.dll to the 32bit version and it worked perfectly. Thanks for your help. Figured I would document this little saga for anyone else interested in this.

Great.

Another piece that I use to determine 32 or 64 bitness is if sys.maxsize > 2**32

sys.path.append(os.getcwd()) doesn't work on Windows for me though, but os.environ['PATH'] worked fine:

import os

if os.name == 'nt': # making sure we're on Windows
	os.environ['PATH'] = os.getcwd() + ';' + os.environ['PATH']

Note: it should be done before import sciter, otherwise you'll have an error.