Watchdog: WinError 58은 μ›ŒμΉ˜λ…μ΄ λ‹€κ°€μ˜€λŠ” 이벀트λ₯Ό μ‹€νŒ¨ν•˜κ²Œ λ§Œλ“­λ‹ˆλ‹€.

에 λ§Œλ“  2015λ…„ 09μ›” 14일  Β·  4μ½”λ©˜νŠΈ  Β·  좜처: gorakhargosh/watchdog

μ•ˆλ…•ν•˜μ„Έμš” μ—¬λŸ¬λΆ„,

QNAP λ‚΄λΆ€μ˜ 폴더λ₯Ό λͺ¨λ‹ˆν„°λ§ν•  λ•Œ μƒˆλ‘œ μƒμ„±λœ νŒŒμΌμ— λŒ€ν•œ 이벀트λ₯Ό κ°€μ Έμ˜¬ 수 μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ μƒˆ 파일이 디렉토리인 경우 μ›ŒμΉ˜λ…μ€ μ‹œμŠ€ν…œ 였λ₯˜μ™€ ν•¨κ»˜ μΆ©λŒν•©λ‹ˆλ‹€.

파일이 μ—¬μ „νžˆ λ³΅μ‚¬λ˜κ³  있기 λ•Œλ¬Έμ΄λΌκ³  μƒκ°ν•˜μ§€λ§Œ 이것이 λ¦¬μŠ€λ„ˆλ₯Ό μΆ©λŒμ‹œν‚€λŠ” μ΄μœ κ°€ λ˜μ–΄μ„œλŠ” μ•ˆ λ©λ‹ˆλ‹€.

μ‘μš© ν”„λ‘œκ·Έλž¨μ΄ Windows 8.1 Proμ—μ„œ μ‹€ν–‰ μ€‘μž…λ‹ˆλ‹€.
QNAP νŽŒμ›¨μ–΄ 버전: 3.7.2 λΉŒλ“œ 20120719
μŠ€νƒ 좔적:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Python34\lib\threading.py", line 920, in _bootstrap_inner
    self.run()
  File "C:\Python34\lib\site-packages\watchdog-0.8.3-py3.4.egg\watchdog\observers\api.py", line 146, in run
    self.queue_events(self.timeout)
  File "C:\Python34\lib\site-packages\watchdog-0.8.3-py3.4.egg\watchdog\observers\read_directory_changes.py", line 77, in queue_events
    winapi_events = read_events(self._handle, self.watch.is_recursive)
  File "C:\Python34\lib\site-packages\watchdog-0.8.3-py3.4.egg\watchdog\observers\winapi.py", line 347, in read_events
    buf, nbytes = read_directory_changes(handle, recursive)
  File "C:\Python34\lib\site-packages\watchdog-0.8.3-py3.4.egg\watchdog\observers\winapi.py", line 307, in read_directory_changes
    raise e
  File "C:\Python34\lib\site-packages\watchdog-0.8.3-py3.4.egg\watchdog\observers\winapi.py", line 303, in read_directory_changes
    ctypes.byref(nbytes), None, None)
  File "C:\Python34\lib\site-packages\watchdog-0.8.3-py3.4.egg\watchdog\observers\winapi.py", line 108, in _errcheck_bool
    raise ctypes.WinError()
OSError: [WinError 58] The specified server cannot perform the requested operation.

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

λ˜ν•œ 이제 dirwatcher μŠ€λ ˆλ“œλ₯Ό 지연/μž¬μ‹œλ„ν•˜λŠ” μ†”λ£¨μ…˜μ„ μ°Ύκ³  μžˆμŠ΅λ‹ˆλ‹€.
OSError: [WinError 64] μ§€μ •λœ λ„€νŠΈμ›Œν¬ 이름을 더 이상 μ‚¬μš©ν•  수 μ—†μŠ΅λ‹ˆλ‹€.

λͺ¨λ“  4 λŒ“κΈ€

WinError 64 및 λ‹€μŒ λ©”μ‹œμ§€κ°€ μžˆλŠ” λ™μΌν•œ λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€. μ§€μ •λœ λ„€νŠΈμ›Œν¬ 이름을 더 이상 μ‚¬μš©ν•  수 μ—†μŠ΅λ‹ˆλ‹€. 이것은 μ‚¬μš©ν•  수 μ—†κ²Œ 된 파일 μ„œλ²„(SMB 곡유)μ—μ„œ 폴더λ₯Ό μ œκ³΅ν•  λ•Œ λ°œμƒν•©λ‹ˆλ‹€.

λ‚˜μ€‘μ— κ΄€μ°°μž 연결을 λ‹€μ‹œ μ‹œλ„ν•˜κΈ° μœ„ν•΄ μ΄λŸ¬ν•œ μ’…λ₯˜μ˜ 였λ₯˜λ₯Ό μ–΄λ–»κ²Œ μž‘μ•„λ‚Ό 수 μžˆμŠ΅λ‹ˆκΉŒ?

λ˜ν•œ 이제 dirwatcher μŠ€λ ˆλ“œλ₯Ό 지연/μž¬μ‹œλ„ν•˜λŠ” μ†”λ£¨μ…˜μ„ μ°Ύκ³  μžˆμŠ΅λ‹ˆλ‹€.
OSError: [WinError 64] μ§€μ •λœ λ„€νŠΈμ›Œν¬ 이름을 더 이상 μ‚¬μš©ν•  수 μ—†μŠ΅λ‹ˆλ‹€.

원격 파일 곡유λ₯Ό λͺ¨λ‹ˆν„°λ§ν•  λ•Œ WinError 64 λ©”μ‹œμ§€κ°€ ν‘œμ‹œλ˜λŠ” 것과 λ™μΌν•œ λ¬Έμ œκ°€ μžˆμ—ˆμŠ΅λ‹ˆλ‹€. λ‚˜λŠ” κ²°κ΅­ 였λ₯˜λ₯Ό ν¬μ°©ν•˜κ³  볡ꡬ할 수 μžˆλŠ” watchdog.utils.BaseThread 클래슀 μ£Όμœ„μ— μž‘μ€ 래퍼λ₯Ό λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€. 그런 λ‹€μŒ Observerλ₯Ό λ§Œλ“€κΈ° 전에 래퍼둜 β€‹β€‹μ›λž˜ BaseThread 클래슀λ₯Ό μ›μˆ­μ΄ νŒ¨μΉ˜ν•©λ‹ˆλ‹€. 제 κ²½μš°μ—λŠ” run λ©”μ„œλ“œμ—μ„œ λ°œμƒν•  수 μžˆλŠ” λͺ¨λ“  μ˜ˆμ™Έλ₯Ό ν¬μ°©ν•˜κ³  λ‹€λ₯Έ μŠ€λ ˆλ“œμ—μ„œ μ‚¬μš©ν•  λŒ€κΈ°μ—΄μ— μΆ”κ°€ν•©λ‹ˆλ‹€. ν•΄ν‚€ μ†”λ£¨μ…˜μ΄μ§€λ§Œ μ†ŒμŠ€ μ½”λ“œ λ³€κ²½ μ—†μ΄λŠ” μ˜΅μ…˜μ΄ λ§Žμ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

import logging
import threading

import watchdog.utils

logger = logging.getLogger(__name__)


class BaseThreadWrapper(watchdog.utils.BaseThread):
    """
    Wrapper around watchdog BaseThread class.

    """
    queue = None

    def __init__(self):
        super(BaseThreadWrapper, self).__init__()
        self._original_run = self.run
        self.run = self.run_wrapper

    def run_wrapper(self):
        try:
            self._original_run()
        except Exception as e:
            logger.exception('%s thread exited with error',
                             threading.current_thread().name)
            self.queue.put(e)


watchdog.utils.BaseThread = BaseThreadWrapper

watchdogμ—μ„œ μ–΄λ–€ μ†”λ£¨μ…˜(μ½”λ“œ λ³€κ²½)을 보고 μ‹ΆμŠ΅λ‹ˆκΉŒ?

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰