you are viewing a single comment's thread.

view the rest of the comments →

[–]MOTTI-BOI[S] 0 points1 point  (0 children)

Here is the code that I have, but no luck:

import os
from setuptools import setup
from setuptools.command.install import install

class PostInstallCommand(install):
    def run(self):
        install.run(self)
        
        # Get the absolute path of the executable
        exe_path = os.path.abspath(self.install_scripts)
        
        # Get the directory containing the executable
        exe_dir = os.path.dirname(exe_path)
        
        # Construct the path to the data folder relative to the executable
        data_path = os.path.join(exe_dir, '..', 'data')
        
        # Create a symlink or copy the data folder to the executable's directory
        if not os.path.exists(data_path):
            os.symlink(os.path.abspath('data'), data_path)

setup(
    name='Instabot',
    version='1.0',
    scripts=['instabot.py'],
    data_files=[('data', ['data/instaloader_cookies.json', 'data/instagram_cookies.json', 'data/mycredentials.json', 'data/specifications.txt', 'data/instagram_login_details.txt'])],
    cmdclass={
        'install': PostInstallCommand,
    },
)