Carson
Carson

Reputation: 1257

Getting IOError: [Errno 21] Is a directory error when trying to run PyInstaller

I'm trying to create an executable file for my Python script using PyInstaller. I run in the terminal...

pyinstaller --onefile --windowed ./lab_attendant_emailer.py

From the directory that the python file is in. It starts running for a bit but returns this error.

12 INFO: PyInstaller: 3.1.1
12 INFO: Python: 2.7.6
12 INFO: Platform: Linux-3.16.0-67-generic-x86_64-with-Ubuntu-14.04-trusty
12 INFO: wrote /home/carsnwd/PycharmProjects/labattendantemailer/lab_attendant_emailer.spec
14 INFO: UPX is not available.
15 INFO: Extending PYTHONPATH with paths
['/home/carsnwd/PycharmProjects/labattendantemailer',
 '/home/carsnwd/PycharmProjects/labattendantemailer']
15 INFO: checking Analysis
21 INFO: checking PYZ
22 INFO: checking PKG
25 INFO: Bootloader /usr/local/lib/python2.7/dist-packages/PyInstaller/bootloader/Linux-64bit/run
25 INFO: checking EXE
25 INFO: Building because name changed
25 INFO: Building EXE from out00-EXE.toc
Traceback (most recent call last):
  File "/usr/local/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==3.1.1', 'console_scripts', 'pyinstaller')()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 755, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 701, in build
    exec(text, spec_namespace)
  File "<string>", line 28, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/api.py", line 498, in __init__
    self.__postinit__()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 183, in __postinit__
    self.assemble()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/api.py", line 575, in assemble
    outf = open(self.name, 'wb')
IOError: [Errno 21] Is a directory: '/home/carsnwd/PycharmProjects/labattendantemailer/dist/lab_attendant_emailer'

Any help with what I'm doing wrong?

Upvotes: 2

Views: 10608

Answers (1)

Neel
Neel

Reputation: 21243

You might be run pyinstaller once and it creates dist directory.

When you try to rerun again, it has all directory structure created with previous command. Please cleanup your directory then rerun pyinstaller, that will work.

Upvotes: 1

Related Questions