Skip to content

Commit 1ab1ebf

Browse files
committed
fix: add entry_point launcher to resolve relative import errors in exe
1 parent 91b653e commit 1ab1ebf

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

entry_point.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import sys
2+
import os
3+
4+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
5+
6+
from netwatch.tui import main
7+
8+
if __name__ == '__main__':
9+
main()

netwatch.spec

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import sys
2+
import os
23
from PyInstaller.utils.hooks import copy_metadata, collect_data_files
34

45
datas = []
56

67
# COLLECT METADATA & RESOURCES
7-
# Textual needs metadata for version info
88
datas += copy_metadata('textual')
9-
# Netwatch needs its own metadata
109
datas += copy_metadata('netwatchpy')
11-
# Desktop Notifier needs metadata AND actual data files (icons, resources)
1210
datas += copy_metadata('desktop_notifier')
11+
# This collects the icons/assets for notifications
1312
datas += collect_data_files('desktop_notifier')
1413

1514
# DEFINE HIDDEN IMPORTS
1615
hidden_imports = [
17-
# Textual Widgets (loaded dynamically, missed by PyInstaller)
1816
'textual.widgets._tab_pane',
1917
'textual.widgets._tabbed_content',
2018
'textual.widgets._data_table',
21-
22-
# Desktop Notifier Resources (loaded dynamically)
2319
'desktop_notifier.resources',
2420
]
2521

@@ -34,8 +30,8 @@ elif sys.platform.startswith('darwin'):
3430
block_cipher = None
3531

3632
a = Analysis(
37-
['src/netwatch/tui.py'],
38-
pathex=[],
33+
['entry_point.py'],
34+
pathex=['src'],
3935
binaries=[],
4036
datas=datas,
4137
hiddenimports=hidden_imports,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "netwatchpy"
7-
version = "1.2.2"
7+
version = "1.2.3"
88
authors = [
99
{ name = "Pranav Kishan", email = "ty.pranavkishan7905@gmail.com" }
1010
]

0 commit comments

Comments
 (0)