mrichar1 / clipster

clipster - python clipboard manager
GNU Affero General Public License v3.0
242 stars 26 forks source link

"NameError: global name 'FileExistsError' is not defined" when launching daemon #78

Closed vicmortelmans closed 6 years ago

vicmortelmans commented 6 years ago

Hi, I tried to install clipster on my Ubuntu 16.04 with i3 window manager. When I launch the daemon, an error occurs. What did I do wrong?

I cloned the git repo and then:

vic@vic-SATELLITE-PRO-A50-D:~/Programs/clipster (master) $ sudo python setup.py build
running build
running build_scripts
vic@vic-SATELLITE-PRO-A50-D:~/Programs/clipster (master) $ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing clipster.egg-info/PKG-INFO
writing top-level names to clipster.egg-info/top_level.txt
writing dependency_links to clipster.egg-info/dependency_links.txt
writing manifest file 'clipster.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install

installing package data to build/bdist.linux-x86_64/egg
running install_data
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/share
creating build/bdist.linux-x86_64/egg/share/licenses
creating build/bdist.linux-x86_64/egg/share/licenses/clipster
copying LICENSE.md -> build/bdist.linux-x86_64/egg/share/licenses/clipster
creating build/bdist.linux-x86_64/egg/share/doc
creating build/bdist.linux-x86_64/egg/share/doc/clipster
copying README.md -> build/bdist.linux-x86_64/egg/share/doc/clipster
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/clipster -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/clipster to 755
copying clipster.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying clipster.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying clipster.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying clipster.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying clipster.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/clipster-2.0.0-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing clipster-2.0.0-py2.7.egg
removing '/usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg
Extracting clipster-2.0.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
clipster 2.0.0 is already the active version in easy-install.pth
Installing clipster script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg
Processing dependencies for clipster==2.0.0
Finished processing dependencies for clipster==2.0.0
vic@vic-SATELLITE-PRO-A50-D:~/Programs/clipster (master) $ which clipster
/usr/local/bin/clipster
vic@vic-SATELLITE-PRO-A50-D:~/Programs/clipster (master) $ clipster -d
Traceback (most recent call last):
  File "/usr/local/bin/clipster", line 4, in <module>
    __import__('pkg_resources').run_script('clipster==2.0.0', 'clipster')
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1504, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg/EGG-INFO/scripts/clipster", line 902, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg/EGG-INFO/scripts/clipster", line 870, in main
    Daemon(config).run()
  File "/usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg/EGG-INFO/scripts/clipster", line 691, in run
    self.prepare_files()
  File "/usr/local/lib/python2.7/dist-packages/clipster-2.0.0-py2.7.egg/EGG-INFO/scripts/clipster", line 619, in prepare_files
    with suppress_if_errno(FileExistsError, errno.EEXIST):
NameError: global name 'FileExistsError' is not defined
mrichar1 commented 6 years ago

Hi - thanks for picking this up. I'd not fully tested the install route of using setup.py so had missed a bug here.

clipster was assuming that configparser only exists on py3.x so was using that as a proxy for version testing. However when you install via setup.py it pulls in a py2 version of configparser from pypi. This then makes clipster incorrectly think its running py3 and other things break.

I've updated clipster to do 'proper' version detection so this should hopefully fix this. Let me know if you still see an error!

vicmortelmans commented 6 years ago

Thanks! Fixed!