We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
NoneType object is not callable
I'm not sure if this is my own stupidity, related to #283, or something I've ended up doing myself by accident.

I'm working on developing a mkdocs theme, and `mkdocs build` and `mkdocs build --clean` both run without any issues.

However, if I try and `mkdocs serve` then I get hit by an error.

```
Traceback (most recent call last):
  File "/home/pi/.virtualenvs/face/bin/mkdocs", line 9, in <module>
    load_entry_point('mkdocs==0.11.1', 'console_scripts', 'mkdocs')()
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/main.py", line 60, in run_main
    main(cmd, args=sys.argv[2:], options=dict(opts))
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/main.py", line 33, in main
    serve(config, options=options)
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/serve.py", line 96, in serve
    observer.start()
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/api.py", line 255, in start
    emitter.start()
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/utils/__init__.py", line 111, in start
    self.on_thread_start()
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py", line 77, in on_thread_start
    self._snapshot = self._take_snapshot()
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py", line 74, in <lambda>
    self.watch.path, self.watch.is_recursive, stat=stat, listdir=listdir)
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/utils/dirsnapshot.py", line 207, in __init__
    st = stat(path)
OSError: [Errno 2] No such file or directory: '/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/themes/face'
Exception in thread Thread-3 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/api.py", line 146, in run
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py", line 91, in queue_events
  File "/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py", line 74, in <lambda>
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
```

My `mkdocs.yml` file is simple, and I don't think it is the actual cause, but it might be in my own inept way:

```
site_name: Face Theme
theme_dir: face
theme: face
use_directory_urls: true
repo_url: https://bitbucket.org/shakna-israel/face
dev_addr: 0.0.0.0:8000
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mkdocs/serve.py`
Content:
```
1 # coding: utf-8
2 from __future__ import print_function
3 
4 from watchdog import events
5 from watchdog.observers.polling import PollingObserver
6 from mkdocs.build import build
7 from mkdocs.compat import httpserver, socketserver, urlunquote
8 from mkdocs.config import load_config
9 import os
10 import posixpath
11 import shutil
12 import sys
13 import tempfile
14 
15 
16 class BuildEventHandler(events.FileSystemEventHandler):
17     """
18     Perform a rebuild when anything in the theme or docs directory changes.
19     """
20     def __init__(self, options):
21         super(BuildEventHandler, self).__init__()
22         self.options = options
23 
24     def on_any_event(self, event):
25         if not isinstance(event, events.DirModifiedEvent):
26             print('Rebuilding documentation...', end='')
27             config = load_config(options=self.options)
28             build(config, live_server=True)
29             print(' done')
30 
31 
32 class ConfigEventHandler(BuildEventHandler):
33     """
34     Perform a rebuild when the config file changes.
35     """
36     def on_any_event(self, event):
37         try:
38             if os.path.basename(event.src_path) == 'mkdocs.yml':
39                 super(ConfigEventHandler, self).on_any_event(event)
40         except Exception as e:
41             print(e)
42 
43 
44 class FixedDirectoryHandler(httpserver.SimpleHTTPRequestHandler):
45     """
46     Override the default implementation to allow us to specify the served
47     directory, instead of being hardwired to the current working directory.
48     """
49     base_dir = os.getcwd()
50 
51     def translate_path(self, path):
52         # abandon query parameters
53         path = path.split('?', 1)[0]
54         path = path.split('#', 1)[0]
55         path = posixpath.normpath(urlunquote(path))
56         words = path.split('/')
57         words = filter(None, words)
58         path = self.base_dir
59         for word in words:
60             drive, word = os.path.splitdrive(word)
61             head, word = os.path.split(word)
62             if word in (os.curdir, os.pardir):
63                 continue
64             path = os.path.join(path, word)
65         return path
66 
67     def log_message(self, format, *args):
68         date_str = self.log_date_time_string()
69         sys.stderr.write('[%s] %s\n' % (date_str, format % args))
70 
71 
72 def serve(config, options=None):
73     """
74     Start the devserver, and rebuild the docs whenever any changes take effect.
75     """
76     # Create a temporary build directory, and set some options to serve it
77     tempdir = tempfile.mkdtemp()
78     options['site_dir'] = tempdir
79 
80     # Only use user-friendly URLs when running the live server
81     options['use_directory_urls'] = True
82 
83     # Perform the initial build
84     config = load_config(options=options)
85     build(config, live_server=True)
86 
87     # Note: We pass any command-line options through so that we
88     #       can re-apply them if the config file is reloaded.
89     event_handler = BuildEventHandler(options)
90     config_event_handler = ConfigEventHandler(options)
91 
92     # We could have used `Observer()`, which can be faster, but
93     # `PollingObserver()` works more universally.
94     observer = PollingObserver()
95     observer.schedule(event_handler, config['docs_dir'], recursive=True)
96     for theme_dir in config['theme_dir']:
97         observer.schedule(event_handler, theme_dir, recursive=True)
98     observer.schedule(config_event_handler, '.')
99     observer.start()
100 
101     class TCPServer(socketserver.TCPServer):
102         allow_reuse_address = True
103 
104     class DocsDirectoryHandler(FixedDirectoryHandler):
105         base_dir = config['site_dir']
106 
107     host, port = config['dev_addr'].split(':', 1)
108     server = TCPServer((host, int(port)), DocsDirectoryHandler)
109 
110     print('Running at: http://%s:%s/' % (host, port))
111     print('Live reload enabled.')
112     print('Hold ctrl+c to quit.')
113     try:
114         server.serve_forever()
115     except KeyboardInterrupt:
116         print('Stopping server...')
117 
118     # Clean up
119     observer.stop()
120     observer.join()
121     shutil.rmtree(tempdir)
122     print('Quit complete')
123
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mkdocs/serve.py b/mkdocs/serve.py
--- a/mkdocs/serve.py
+++ b/mkdocs/serve.py
@@ -94,6 +94,8 @@
     observer = PollingObserver()
     observer.schedule(event_handler, config['docs_dir'], recursive=True)
     for theme_dir in config['theme_dir']:
+        if not os.path.exists(theme_dir):
+            continue
         observer.schedule(event_handler, theme_dir, recursive=True)
     observer.schedule(config_event_handler, '.')
     observer.start()

{"golden_diff": "diff --git a/mkdocs/serve.py b/mkdocs/serve.py\n--- a/mkdocs/serve.py\n+++ b/mkdocs/serve.py\n@@ -94,6 +94,8 @@\n     observer = PollingObserver()\n     observer.schedule(event_handler, config['docs_dir'], recursive=True)\n     for theme_dir in config['theme_dir']:\n+        if not os.path.exists(theme_dir):\n+            continue\n         observer.schedule(event_handler, theme_dir, recursive=True)\n     observer.schedule(config_event_handler, '.')\n     observer.start()\n", "issue": "NoneType object is not callable\nI'm not sure if this is my own stupidity, related to #283, or something I've ended up doing myself by accident.\n\nI'm working on developing a mkdocs theme, and `mkdocs build` and `mkdocs build --clean` both run without any issues.\n\nHowever, if I try and `mkdocs serve` then I get hit by an error.\n\n```\nTraceback (most recent call last):\n  File \"/home/pi/.virtualenvs/face/bin/mkdocs\", line 9, in <module>\n    load_entry_point('mkdocs==0.11.1', 'console_scripts', 'mkdocs')()\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/main.py\", line 60, in run_main\n    main(cmd, args=sys.argv[2:], options=dict(opts))\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/main.py\", line 33, in main\n    serve(config, options=options)\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/serve.py\", line 96, in serve\n    observer.start()\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/api.py\", line 255, in start\n    emitter.start()\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/utils/__init__.py\", line 111, in start\n    self.on_thread_start()\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py\", line 77, in on_thread_start\n    self._snapshot = self._take_snapshot()\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py\", line 74, in <lambda>\n    self.watch.path, self.watch.is_recursive, stat=stat, listdir=listdir)\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/utils/dirsnapshot.py\", line 207, in __init__\n    st = stat(path)\nOSError: [Errno 2] No such file or directory: '/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/mkdocs/themes/face'\nException in thread Thread-3 (most likely raised during interpreter shutdown):\nTraceback (most recent call last):\n  File \"/usr/lib/python2.7/threading.py\", line 552, in __bootstrap_inner\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/api.py\", line 146, in run\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py\", line 91, in queue_events\n  File \"/home/pi/.virtualenvs/face/local/lib/python2.7/site-packages/watchdog/observers/polling.py\", line 74, in <lambda>\n<type 'exceptions.TypeError'>: 'NoneType' object is not callable\n```\n\nMy `mkdocs.yml` file is simple, and I don't think it is the actual cause, but it might be in my own inept way:\n\n```\nsite_name: Face Theme\ntheme_dir: face\ntheme: face\nuse_directory_urls: true\nrepo_url: https://bitbucket.org/shakna-israel/face\ndev_addr: 0.0.0.0:8000\n```\n\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import print_function\n\nfrom watchdog import events\nfrom watchdog.observers.polling import PollingObserver\nfrom mkdocs.build import build\nfrom mkdocs.compat import httpserver, socketserver, urlunquote\nfrom mkdocs.config import load_config\nimport os\nimport posixpath\nimport shutil\nimport sys\nimport tempfile\n\n\nclass BuildEventHandler(events.FileSystemEventHandler):\n    \"\"\"\n    Perform a rebuild when anything in the theme or docs directory changes.\n    \"\"\"\n    def __init__(self, options):\n        super(BuildEventHandler, self).__init__()\n        self.options = options\n\n    def on_any_event(self, event):\n        if not isinstance(event, events.DirModifiedEvent):\n            print('Rebuilding documentation...', end='')\n            config = load_config(options=self.options)\n            build(config, live_server=True)\n            print(' done')\n\n\nclass ConfigEventHandler(BuildEventHandler):\n    \"\"\"\n    Perform a rebuild when the config file changes.\n    \"\"\"\n    def on_any_event(self, event):\n        try:\n            if os.path.basename(event.src_path) == 'mkdocs.yml':\n                super(ConfigEventHandler, self).on_any_event(event)\n        except Exception as e:\n            print(e)\n\n\nclass FixedDirectoryHandler(httpserver.SimpleHTTPRequestHandler):\n    \"\"\"\n    Override the default implementation to allow us to specify the served\n    directory, instead of being hardwired to the current working directory.\n    \"\"\"\n    base_dir = os.getcwd()\n\n    def translate_path(self, path):\n        # abandon query parameters\n        path = path.split('?', 1)[0]\n        path = path.split('#', 1)[0]\n        path = posixpath.normpath(urlunquote(path))\n        words = path.split('/')\n        words = filter(None, words)\n        path = self.base_dir\n        for word in words:\n            drive, word = os.path.splitdrive(word)\n            head, word = os.path.split(word)\n            if word in (os.curdir, os.pardir):\n                continue\n            path = os.path.join(path, word)\n        return path\n\n    def log_message(self, format, *args):\n        date_str = self.log_date_time_string()\n        sys.stderr.write('[%s] %s\\n' % (date_str, format % args))\n\n\ndef serve(config, options=None):\n    \"\"\"\n    Start the devserver, and rebuild the docs whenever any changes take effect.\n    \"\"\"\n    # Create a temporary build directory, and set some options to serve it\n    tempdir = tempfile.mkdtemp()\n    options['site_dir'] = tempdir\n\n    # Only use user-friendly URLs when running the live server\n    options['use_directory_urls'] = True\n\n    # Perform the initial build\n    config = load_config(options=options)\n    build(config, live_server=True)\n\n    # Note: We pass any command-line options through so that we\n    #       can re-apply them if the config file is reloaded.\n    event_handler = BuildEventHandler(options)\n    config_event_handler = ConfigEventHandler(options)\n\n    # We could have used `Observer()`, which can be faster, but\n    # `PollingObserver()` works more universally.\n    observer = PollingObserver()\n    observer.schedule(event_handler, config['docs_dir'], recursive=True)\n    for theme_dir in config['theme_dir']:\n        observer.schedule(event_handler, theme_dir, recursive=True)\n    observer.schedule(config_event_handler, '.')\n    observer.start()\n\n    class TCPServer(socketserver.TCPServer):\n        allow_reuse_address = True\n\n    class DocsDirectoryHandler(FixedDirectoryHandler):\n        base_dir = config['site_dir']\n\n    host, port = config['dev_addr'].split(':', 1)\n    server = TCPServer((host, int(port)), DocsDirectoryHandler)\n\n    print('Running at: http://%s:%s/' % (host, port))\n    print('Live reload enabled.')\n    print('Hold ctrl+c to quit.')\n    try:\n        server.serve_forever()\n    except KeyboardInterrupt:\n        print('Stopping server...')\n\n    # Clean up\n    observer.stop()\n    observer.join()\n    shutil.rmtree(tempdir)\n    print('Quit complete')\n", "path": "mkdocs/serve.py"}], "after_files": [{"content": "# coding: utf-8\nfrom __future__ import print_function\n\nfrom watchdog import events\nfrom watchdog.observers.polling import PollingObserver\nfrom mkdocs.build import build\nfrom mkdocs.compat import httpserver, socketserver, urlunquote\nfrom mkdocs.config import load_config\nimport os\nimport posixpath\nimport shutil\nimport sys\nimport tempfile\n\n\nclass BuildEventHandler(events.FileSystemEventHandler):\n    \"\"\"\n    Perform a rebuild when anything in the theme or docs directory changes.\n    \"\"\"\n    def __init__(self, options):\n        super(BuildEventHandler, self).__init__()\n        self.options = options\n\n    def on_any_event(self, event):\n        if not isinstance(event, events.DirModifiedEvent):\n            print('Rebuilding documentation...', end='')\n            config = load_config(options=self.options)\n            build(config, live_server=True)\n            print(' done')\n\n\nclass ConfigEventHandler(BuildEventHandler):\n    \"\"\"\n    Perform a rebuild when the config file changes.\n    \"\"\"\n    def on_any_event(self, event):\n        try:\n            if os.path.basename(event.src_path) == 'mkdocs.yml':\n                super(ConfigEventHandler, self).on_any_event(event)\n        except Exception as e:\n            print(e)\n\n\nclass FixedDirectoryHandler(httpserver.SimpleHTTPRequestHandler):\n    \"\"\"\n    Override the default implementation to allow us to specify the served\n    directory, instead of being hardwired to the current working directory.\n    \"\"\"\n    base_dir = os.getcwd()\n\n    def translate_path(self, path):\n        # abandon query parameters\n        path = path.split('?', 1)[0]\n        path = path.split('#', 1)[0]\n        path = posixpath.normpath(urlunquote(path))\n        words = path.split('/')\n        words = filter(None, words)\n        path = self.base_dir\n        for word in words:\n            drive, word = os.path.splitdrive(word)\n            head, word = os.path.split(word)\n            if word in (os.curdir, os.pardir):\n                continue\n            path = os.path.join(path, word)\n        return path\n\n    def log_message(self, format, *args):\n        date_str = self.log_date_time_string()\n        sys.stderr.write('[%s] %s\\n' % (date_str, format % args))\n\n\ndef serve(config, options=None):\n    \"\"\"\n    Start the devserver, and rebuild the docs whenever any changes take effect.\n    \"\"\"\n    # Create a temporary build directory, and set some options to serve it\n    tempdir = tempfile.mkdtemp()\n    options['site_dir'] = tempdir\n\n    # Only use user-friendly URLs when running the live server\n    options['use_directory_urls'] = True\n\n    # Perform the initial build\n    config = load_config(options=options)\n    build(config, live_server=True)\n\n    # Note: We pass any command-line options through so that we\n    #       can re-apply them if the config file is reloaded.\n    event_handler = BuildEventHandler(options)\n    config_event_handler = ConfigEventHandler(options)\n\n    # We could have used `Observer()`, which can be faster, but\n    # `PollingObserver()` works more universally.\n    observer = PollingObserver()\n    observer.schedule(event_handler, config['docs_dir'], recursive=True)\n    for theme_dir in config['theme_dir']:\n        if not os.path.exists(theme_dir):\n            continue\n        observer.schedule(event_handler, theme_dir, recursive=True)\n    observer.schedule(config_event_handler, '.')\n    observer.start()\n\n    class TCPServer(socketserver.TCPServer):\n        allow_reuse_address = True\n\n    class DocsDirectoryHandler(FixedDirectoryHandler):\n        base_dir = config['site_dir']\n\n    host, port = config['dev_addr'].split(':', 1)\n    server = TCPServer((host, int(port)), DocsDirectoryHandler)\n\n    print('Running at: http://%s:%s/' % (host, port))\n    print('Live reload enabled.')\n    print('Hold ctrl+c to quit.')\n    try:\n        server.serve_forever()\n    except KeyboardInterrupt:\n        print('Stopping server...')\n\n    # Clean up\n    observer.stop()\n    observer.join()\n    shutil.rmtree(tempdir)\n    print('Quit complete')\n", "path": "mkdocs/serve.py"}]}