0

I am trying to create an executable (onefile\onedir does not matter) with pyinstaller to show the folium map in GUI. I managed to successfully create the exe. It runs perfectly on the machine where I created it, but when I tried to test it on other machines (same OS) it opens correctly, but when setting the HTML, the view disappears leaving a blank space.

SPEC file:

import os
from osgeo import gdal, ogr, osr
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
from geopandas import GeoDataFrame
from PyInstaller.utils.hooks import collect_data_files
from PyInstaller.utils.hooks import collect_dynamic_libs
from ctypes.util import find_library

block_cipher = None


a = Analysis(['Main.py'],
         pathex=        
         ['...\\With_proxy_ALLWORKING\\TEST7_working2', 'C:\\ProgramData\\Anaconda3'],
         binaries=collect_dynamic_libs("rtree") + [('C:\ProgramData\Anaconda3\*.dll', '.')] + [("...\With_proxy_ALLWORKING\TEST7_working2\libiomp5md.dll", ".")],
         datas=[
         ("C:\\Users\\corra\\.conda\\envs\\oxenv2\\Lib\\site-packages\\branca\\*.json","branca"),
         ("C:\\Users\\corra\\.conda\\envs\\oxenv2\\Lib\\site-packages\\branca\\templates","templates"),
         ("C:\\Users\\corra\\.conda\\envs\\oxenv2\\Lib\\site-packages\\folium\\templates","templates"),
         ("C:\\Users\\corra\\.conda\\envs\\oxenv2\\Lib\\site-packages\\geopandas\\datasets\\naturalearth_cities\\*.*", "geopandas\\datasets\\naturalearth_cities"),
         ("C:\\Users\\corra\\.conda\\envs\\oxenv2\\Lib\\site-packages\\geopandas\\datasets\\naturalearth_lowres\\*.*", "geopandas\\datasets\\naturalearth_lowres"),
         ("...\\TEST7_working2\\logo.png", ".")
         ],
         hiddenimports=['fiona._shim', 
                       'fiona.schema',    
                       'ctypes',
                       'ctypes.util',
                       'fiona',
                       'gdal',
                       'geos',
                       'shapely',
                       'shapely.geometry',
                       'pyproj',
                       'rtree',
                       'geopandas.datasets',
                       'pytest',
                       'pandas._libs.tslibs.timedeltas'],
         hookspath=[],
         hooksconfig={},
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher,
         noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)

exe = EXE(pyz,
      a.scripts, 
      [],
      exclude_binaries=True,
      name='Main',
      debug=True,
      bootloader_ignore_signals=False,
      strip=False,
      upx=False,
      console=True,
      disable_windowed_traceback=False,
      target_arch=None,
      codesign_identity=None,
      entitlements_file=None )
coll = COLLECT(exe,
           a.binaries,
           a.zipfiles,
           a.datas, 
           strip=False,
           upx=False,
           upx_exclude=[],
           name='Main')
Omid Zarinmahd
  • 158
  • 1
  • 1
  • 11
CLU
  • 23
  • 1
  • 6
  • first run `.exe` on new machine in console/terminal to see full error message. – furas Oct 25 '21 at 08:22
  • In the console I cannot see anything. The last message says 'Running Main.py'. When the window opens, I can see a white box (where the page will be loaded) just for a moment and then it disappears. If I click on the button connected to the load function, it appears for just a second and then disappears again. No error messages and the exe keeps going with no crash. I tried this https://stackoverflow.com/questions/66646537/using-qwebengine-of-qt5/66657034#66657034 but did not work. – CLU Oct 25 '21 at 12:19
  • did you run code manually in console? You could use `print()` to see what you have in variables - especially you should check if you use hardcoded paths to elements - it can make problem when you run it in different place. You can also use `print()` to see which part of code is executed - it is called `"print debuging"`. And this should be first step when you have some problem - you have to debug code. – furas Oct 25 '21 at 12:21
  • BTW: if you don't have any error messages from program and you don't use `print()` to see some information then you can't know what is really a problem and using solution from your link can be totally useless. First you have to debug code - you have to check if it uses values which you expect and if it run code which you expect. – furas Oct 25 '21 at 12:24

0 Answers0