Back in 2010, Martin Zibricky wrote about adding a folder to --onefile. The method was simply to change the following:
coll = COLLECT(exe, a.binaries, ...

to:
coll = COLLECT(exe, a.binaries + [('testFolder', 'C:/testFolder', 'DATA')], ...

I'm trying to do this now, but I keep getting an "IOError: [Errno 13] Permission denied" error, even when it's a simple folder containing just a plain text file. I've tried with various folders in various locations. The problem is the same. I also confirmed that the above line causes the error. Removing the + [('testFolder', 'C:/testFolder', 'DATA')] part of collect results in a perfect build with no errorrs. Here's the traceback:

Traceback (most recent call last):
File "Z:\@@portable_apps\PortableApps\PyInstaller\utils\Build.py", line 56, in <module>
    PyInstaller.build.main(args[0], **opts.__dict__)
File "Z:\@@portable_apps\PortableApps\PyInstaller\PyInstaller\build.py", line 1709, in main
    build(specfile, buildpath)
File "Z:\@@portable_apps\PortableApps\PyInstaller\PyInstaller\build.py", line 1666, in build
    execfile(spec)
File "Z:\@@eclipse_workspace\RPyProjects\bundleAll\PypeR_demo_001.spec", line 22, in <module>
    name=os.path.join('dist', 'PypeR_demo_001'))
File "Z:\@@portable_apps\PortableApps\PyInstaller\PyInstaller\build.py", line 1257, in __init__
    self.__postinit__()
File "Z:\@@portable_apps\PortableApps\PyInstaller\PyInstaller\build.py", line 312, in __postinit__
    self.assemble()
File "Z:\@@portable_apps\PortableApps\PyInstaller\PyInstaller\build.py", line 1289, in assemble
    shutil.copy2(fnm, tofnm)
File "Z:\@@portable_apps\PortableApps\PythonPortable\App\lib\shutil.py", line 128, in copy2
    copyfile(src, dst)
File "Z:\@@portable_apps\PortableApps\PythonPortable\App\lib\shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 13] Permission denied: 'C:/testFolder'

Can someone confirm that Martin's approach really works, and perhaps suggest where I'm going wrong? If you have an alternative approach, that would be fine, too.

Thank you!
Laurence.

Below is Martin's complete solution:

#####################
Pyinstaller should support that. However I didn't use that yet. But:

In your spec file you should tweak the collect section.

 coll = COLLECT(exe,
                a.binaries,
                a.zipfiles,
                a.datas,
                strip=False,
                upx=False,
                name=os.path.join('dist', __testname__))

like:

 coll = COLLECT(exe,
                a.binaries +
                [('skins', '/my/project/skins', 'DATA')],
                a.zipfiles,
                a.datas,
                strip=False,
                upx=False,
                name=os.path.join('dist', __testname__))

the skins folder should be accessible at runtime like:

os.path.join(os.environ["_MEIPASS2], 'skins'))

#####################

--
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to