Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError when creating a project #12636

Closed
bunop opened this issue May 6, 2020 · 8 comments · Fixed by gorakhargosh/watchdog#669
Closed

OSError when creating a project #12636

bunop opened this issue May 6, 2020 · 8 comments · Fixed by gorakhargosh/watchdog#669

Comments

@bunop
Copy link

bunop commented May 6, 2020

Description

What steps will reproduce the problem?

Project -> new, then checklist the existing directory and choosing a directory with python files. I was able to create and manage a project in the same directory with and old sypder version (spyder 3)

Traceback

  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/spyder/plugins/projects/plugin.py", line 284, in _create_project
    self.open_project(path=path)
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/spyder/plugins/projects/plugin.py", line 330, in open_project
    self.watcher.start(path)
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/spyder/plugins/projects/utils/watcher.py", line 153, in start
    raise e
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/spyder/plugins/projects/utils/watcher.py", line 128, in start
    self.observer.start()
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/api.py", line 253, in start
    emitter.start()
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/utils/__init__.py", line 110, in start
    self.on_thread_start()
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/inotify.py", line 121, in on_thread_start
    self._inotify = InotifyBuffer(path, self.watch.is_recursive)
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/inotify_buffer.py", line 35, in __init__
    self._inotify = Inotify(path, recursive)
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/inotify_c.py", line 200, in __init__
    self._add_dir_watch(path, recursive, event_mask)
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/inotify_c.py", line 395, in _add_dir_watch
    self._add_watch(full_path, mask)
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/inotify_c.py", line 409, in _add_watch
    Inotify._raise_error()
  File "/home/paolo/Softwares/anaconda3/lib/python3.7/site-packages/watchdog/observers/inotify_c.py", line 425, in _raise_error
    raise OSError(err, os.strerror(err))
PermissionError: [Errno 13] Permission denied

Versions

  • Spyder version: 4.1.2
  • Python version: 3.7.3
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Linux 4.9.0-12-amd64

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.3.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
keyring                        :  None (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.9 (OK)
qdarkstyle >=2.8               :  2.8 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.2 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.4.4 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
xdg >=0.26                     :  0.26 (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.15 (OK)
matplotlib >=2.0.0             :  3.1.3 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.3 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.5.1 (OK)
@spyder-bot
Copy link
Collaborator

To fix this, please open the Anaconda Prompt and run there the following commands:

conda update anaconda
conda install jupyter_client=5.3.4

@bunop
Copy link
Author

bunop commented May 6, 2020

The solution proposed doesn't solve my problems. The problem is related to the permission of a directory inside the project (in my case, a postgres data docker volume that the spyder user doesn't own). Modifying Inotify._raise_error like this, is sufficent to avoid the exception:

    @staticmethod
    def _raise_error():
        """
        Raises errors for inotify failures.
        """
        err = ctypes.get_errno()
        if err == errno.ENOSPC:
            raise OSError(errno.ENOSPC, "inotify watch limit reached")
        elif err == errno.EMFILE:
            raise OSError(errno.EMFILE, "inotify instance limit reached")
        elif err == errno.EACCES:
            print(err, os.strerror(err))
        else:
            raise OSError(err, os.strerror(err))

dealing with errno.EACCES without raisin the exception is sufficent. However, I don't understand why watching all the files and the directory in a spyder project. Is watching directory like .git or docker data directory necessary? could be possible to avoid watching directory that I can't open?

@goanpeca goanpeca reopened this May 6, 2020
@goanpeca
Copy link
Member

goanpeca commented May 6, 2020

docker data directory necessary? could be possible to avoid watching directory that I can't open?

This will be added in a future release :-)

@goanpeca
Copy link
Member

goanpeca commented May 6, 2020

@andfoy I think you know well this part of the code. Please work on a fix for this. Thanks!

@bunop
Copy link
Author

bunop commented May 7, 2020

Ty all for the support!

@ccordoba12 ccordoba12 changed the title Create a new project in existing directory OSError when creating a project May 7, 2020
@ccordoba12 ccordoba12 added this to Release in v4.1.4 May 7, 2020
@ccordoba12 ccordoba12 modified the milestones: Sprint May, Sprint June Jun 1, 2020
@ccordoba12 ccordoba12 removed this from Release in v4.1.4 Jun 20, 2020
@ccordoba12
Copy link
Member

@bunop, thanks for letting us know the solution for your problem. @andfoy submitted gorakhargosh/watchdog#669 with it, so now it's up to the Watchdog maintainers to merge it.

@BoboTiG
Copy link

BoboTiG commented Jun 25, 2020

The new version of watchdog (0.10.3) containing the fix is online :)

@ccordoba12
Copy link
Member

Thanks @BoboTiG!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment