prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  The export-schema command fails when trying to import local modules
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `strawberry/cli/commands/export_schema.py`
  Content:
  ```
  1 import click
  2 
  3 from strawberry import Schema
  4 from strawberry.printer import print_schema
  5 from strawberry.utils.importer import import_module_symbol
  6 
  7 
  8 @click.command(short_help="Exports the schema")
  9 @click.argument("schema", type=str)
  10 def export_schema(schema: str):
  11     try:
  12         schema_symbol = import_module_symbol(schema, default_symbol_name="schema")
  13     except (ImportError, AttributeError) as exc:
  14         message = str(exc)
  15         raise click.BadArgumentUsage(message)
  16     if not isinstance(schema_symbol, Schema):
  17         message = "The `schema` must be an instance of strawberry.Schema"
  18         raise click.BadArgumentUsage(message)
  19     print(print_schema(schema_symbol))
  20
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/strawberry/cli/commands/export_schema.py b/strawberry/cli/commands/export_schema.py
  --- a/strawberry/cli/commands/export_schema.py
  +++ b/strawberry/cli/commands/export_schema.py
  @@ -1,3 +1,5 @@
  +import sys
  +
   import click
   
   from strawberry import Schema
  @@ -7,7 +9,20 @@
   
   @click.command(short_help="Exports the schema")
   @click.argument("schema", type=str)
  -def export_schema(schema: str):
  +@click.option(
  +    "--app-dir",
  +    default=".",
  +    type=str,
  +    show_default=True,
  +    help=(
  +        "Look for the module in the specified directory, by adding this to the "
  +        "PYTHONPATH. Defaults to the current working directory. "
  +        "Works the same as `--app-dir` in uvicorn."
  +    ),
  +)
  +def export_schema(schema: str, app_dir):
  +    sys.path.insert(0, app_dir)
  +
       try:
           schema_symbol = import_module_symbol(schema, default_symbol_name="schema")
       except (ImportError, AttributeError) as exc:
  
verification_info: {"golden_diff": "diff --git a/strawberry/cli/commands/export_schema.py b/strawberry/cli/commands/export_schema.py\n--- a/strawberry/cli/commands/export_schema.py\n+++ b/strawberry/cli/commands/export_schema.py\n@@ -1,3 +1,5 @@\n+import sys\n+\n import click\n \n from strawberry import Schema\n@@ -7,7 +9,20 @@\n \n @click.command(short_help=\"Exports the schema\")\n @click.argument(\"schema\", type=str)\n-def export_schema(schema: str):\n+@click.option(\n+    \"--app-dir\",\n+    default=\".\",\n+    type=str,\n+    show_default=True,\n+    help=(\n+        \"Look for the module in the specified directory, by adding this to the \"\n+        \"PYTHONPATH. Defaults to the current working directory. \"\n+        \"Works the same as `--app-dir` in uvicorn.\"\n+    ),\n+)\n+def export_schema(schema: str, app_dir):\n+    sys.path.insert(0, app_dir)\n+\n     try:\n         schema_symbol = import_module_symbol(schema, default_symbol_name=\"schema\")\n     except (ImportError, AttributeError) as exc:\n", "issue": "The export-schema command fails when trying to import local modules\n\n", "before_files": [{"content": "import click\n\nfrom strawberry import Schema\nfrom strawberry.printer import print_schema\nfrom strawberry.utils.importer import import_module_symbol\n\n\n@click.command(short_help=\"Exports the schema\")\n@click.argument(\"schema\", type=str)\ndef export_schema(schema: str):\n    try:\n        schema_symbol = import_module_symbol(schema, default_symbol_name=\"schema\")\n    except (ImportError, AttributeError) as exc:\n        message = str(exc)\n        raise click.BadArgumentUsage(message)\n    if not isinstance(schema_symbol, Schema):\n        message = \"The `schema` must be an instance of strawberry.Schema\"\n        raise click.BadArgumentUsage(message)\n    print(print_schema(schema_symbol))\n", "path": "strawberry/cli/commands/export_schema.py"}], "after_files": [{"content": "import sys\n\nimport click\n\nfrom strawberry import Schema\nfrom strawberry.printer import print_schema\nfrom strawberry.utils.importer import import_module_symbol\n\n\n@click.command(short_help=\"Exports the schema\")\n@click.argument(\"schema\", type=str)\n@click.option(\n    \"--app-dir\",\n    default=\".\",\n    type=str,\n    show_default=True,\n    help=(\n        \"Look for the module in the specified directory, by adding this to the \"\n        \"PYTHONPATH. Defaults to the current working directory. \"\n        \"Works the same as `--app-dir` in uvicorn.\"\n    ),\n)\ndef export_schema(schema: str, app_dir):\n    sys.path.insert(0, app_dir)\n\n    try:\n        schema_symbol = import_module_symbol(schema, default_symbol_name=\"schema\")\n    except (ImportError, AttributeError) as exc:\n        message = str(exc)\n        raise click.BadArgumentUsage(message)\n    if not isinstance(schema_symbol, Schema):\n        message = \"The `schema` must be an instance of strawberry.Schema\"\n        raise click.BadArgumentUsage(message)\n    print(print_schema(schema_symbol))\n", "path": "strawberry/cli/commands/export_schema.py"}]}