Skip to content

Instantly share code, notes, and snippets.

@sefgit
Created May 26, 2024 02:22
Show Gist options
  • Save sefgit/470a14ff9d7ca31549305229e12e1032 to your computer and use it in GitHub Desktop.
Save sefgit/470a14ff9d7ca31549305229e12e1032 to your computer and use it in GitHub Desktop.
Freezing python lightweight_charts using pyinstaller
from os import chdir
from os.path import dirname
import multiprocessing
import numpy as np
import pandas as pd
import asyncio
from lightweight_charts import Chart
async def main():
#print(sys._MEIPASS)
#chdir(sys._MEIPASS)
FOLDER = dirname(__file__)
chdir(FOLDER)
chart = Chart(title='candles', debug=False)
df = pd.read_csv('ohlcv.csv')
chart.set(df)
await chart.show_async(block=True)
if __name__ == '__main__':
multiprocessing.freeze_support()
asyncio.run(main())
@echo off
pyi-makespec --collect-all lightweight_charts --collect-all webview --collect-submodules pandas._libs --add-data ohlcv.csv:. chart.py
pyinstaller chart.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment