I am trying to create a standalone app from my Python script login.py although I am getting the error when running it:
I have changed the login.spec and added the datas list as at the official documentation Using Spec Files
/Users.../ is just the summarised path to make it readable here, it is complete in my file.
datas=[ ('/Users.../tiktok/*.png', '.' ) , ('/Users/.../tiktok/*.jpg', '.' ) ],
Command to create the bundle:
pyinstaller -D -F -w login.spec login.py
Traceback (most recent call last):
  File "login.py", line 126, in <module>
  File "login.py", line 82, in main
  File "PIL/Image.py", line 2904, in open
FileNotFoundError: [Errno 2] No such file or directory: '/liberty.jpg'
[53518] Failed to execute script login
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
That means that the .jpg and .png are not bundled.
login.py
from tkinter import *
from PIL import Image, ImageTk
import requests
import json
def main():
    global rootLogin
    rootLogin = Tk()
    rootLogin.geometry("720x540")
    rootLogin.eval('tk::PlaceWindow . center')
    rootLogin.title("Login | bla bla bla")
    # Logo
    load = Image.open(curPath + "/liberty.jpg")
    load = load.resize((136, 84), Image.ANTIALIAS)
    render = ImageTk.PhotoImage(load)
    img = Label(rootLogin, image=render)
    img.image = render
    img.place(x=293, y=86)
    # Username
    ...
    # Password
    ...
    # Forgot password
    ...
    # Login
    ...
    rootLogin.mainloop()
if __name__ == '__main__':
    import os
    curPath = os.path.dirname(__file__)
    print(curPath)
    main()
login.spec
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['login.py'],
             pathex=['/Users/.../tiktok'],
             binaries=[],
             datas=[ ('/Users.../tiktok/*.png', '.' ) , ('/Users/.../tiktok/*.jpg', '.' ) ],
             hiddenimports=[],
             hookspath=[],
             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,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='login',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=False )
app = BUNDLE(exe,
             name='login.app',
             icon=None,
             bundle_identifier=None)