We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ImportError on any CLI command on Windows
Hi there,

I just ran `pip install awscli` in a new Python 2.7 virtual environment on Windows.  It installed successfully, but any command I run gives output like this:

```
$ aws ecr get-login --region us-east-1
Traceback (most recent call last):
  File "...\.tox\tools\Scripts\aws.cmd", line 50, in <module>
    import awscli.clidriver
ImportError: No module named awscli.clidriver
```

The package in the virtual environment seems fine and I can run this command successfully (no `ImportError`):

```
$ python -c "from awscli.clidriver import main; main()" ecr get-login --region us-east-1
Unable to locate credentials. You can configure credentials by running "aws configure".
```

Any idea what's wrong?

I'm using this version:

```
$ pip freeze | grep awscli
awscli==1.11.36
```
ImportError on any CLI command on Windows
Hi there,

I just ran `pip install awscli` in a new Python 2.7 virtual environment on Windows.  It installed successfully, but any command I run gives output like this:

```
$ aws ecr get-login --region us-east-1
Traceback (most recent call last):
  File "...\.tox\tools\Scripts\aws.cmd", line 50, in <module>
    import awscli.clidriver
ImportError: No module named awscli.clidriver
```

The package in the virtual environment seems fine and I can run this command successfully (no `ImportError`):

```
$ python -c "from awscli.clidriver import main; main()" ecr get-login --region us-east-1
Unable to locate credentials. You can configure credentials by running "aws configure".
```

Any idea what's wrong?

I'm using this version:

```
$ pip freeze | grep awscli
awscli==1.11.36
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 import codecs
3 import os.path
4 import re
5 import sys
6 
7 from setuptools import setup, find_packages
8 
9 
10 here = os.path.abspath(os.path.dirname(__file__))
11 
12 
13 def read(*parts):
14     return codecs.open(os.path.join(here, *parts), 'r').read()
15 
16 
17 def find_version(*file_paths):
18     version_file = read(*file_paths)
19     version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
20                               version_file, re.M)
21     if version_match:
22         return version_match.group(1)
23     raise RuntimeError("Unable to find version string.")
24 
25 
26 requires = ['botocore==1.5.43',
27             'colorama>=0.2.5,<=0.3.7',
28             'docutils>=0.10',
29             'rsa>=3.1.2,<=3.5.0',
30             's3transfer>=0.1.9,<0.2.0',
31             'PyYAML>=3.10,<=3.12']
32 
33 
34 if sys.version_info[:2] == (2, 6):
35     # For python2.6 we have to require argparse since it
36     # was not in stdlib until 2.7.
37     requires.append('argparse>=1.1')
38 
39 
40 setup_options = dict(
41     name='awscli',
42     version=find_version("awscli", "__init__.py"),
43     description='Universal Command Line Environment for AWS.',
44     long_description=open('README.rst').read(),
45     author='Amazon Web Services',
46     url='http://aws.amazon.com/cli/',
47     scripts=['bin/aws', 'bin/aws.cmd',
48              'bin/aws_completer', 'bin/aws_zsh_completer.sh',
49              'bin/aws_bash_completer'],
50     packages=find_packages(exclude=['tests*']),
51     package_data={'awscli': ['data/*.json', 'examples/*/*.rst',
52                              'examples/*/*/*.rst', 'topics/*.rst',
53                              'topics/*.json']},
54     install_requires=requires,
55     extras_require={
56         ':python_version=="2.6"': [
57             'argparse>=1.1',
58         ]
59     },
60     license="Apache License 2.0",
61     classifiers=(
62         'Development Status :: 5 - Production/Stable',
63         'Intended Audience :: Developers',
64         'Intended Audience :: System Administrators',
65         'Natural Language :: English',
66         'License :: OSI Approved :: Apache Software License',
67         'Programming Language :: Python',
68         'Programming Language :: Python :: 2.6',
69         'Programming Language :: Python :: 2.7',
70         'Programming Language :: Python :: 3',
71         'Programming Language :: Python :: 3.3',
72         'Programming Language :: Python :: 3.4',
73         'Programming Language :: Python :: 3.5',
74         'Programming Language :: Python :: 3.6',
75     ),
76 )
77 
78 if 'py2exe' in sys.argv:
79     # This will actually give us a py2exe command.
80     import py2exe
81     # And we have some py2exe specific options.
82     setup_options['options'] = {
83         'py2exe': {
84             'optimize': 0,
85             'skip_archive': True,
86             'dll_excludes': ['crypt32.dll'],
87             'packages': ['docutils', 'urllib', 'httplib', 'HTMLParser',
88                          'awscli', 'ConfigParser', 'xml.etree', 'pipes'],
89         }
90     }
91     setup_options['console'] = ['bin/aws']
92 
93 
94 setup(**setup_options)
95
```

Path: `awscli/__init__.py`
Content:
```
1 # Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"). You
4 # may not use this file except in compliance with the License. A copy of
5 # the License is located at
6 #
7 #     http://aws.amazon.com/apache2.0/
8 #
9 # or in the "license" file accompanying this file. This file is
10 # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 # ANY KIND, either express or implied. See the License for the specific
12 # language governing permissions and limitations under the License.
13 """
14 AWSCLI
15 ----
16 A Universal Command Line Environment for Amazon Web Services.
17 """
18 import os
19 
20 __version__ = '1.11.80'
21 
22 #
23 # Get our data path to be added to botocore's search path
24 #
25 _awscli_data_path = []
26 if 'AWS_DATA_PATH' in os.environ:
27     for path in os.environ['AWS_DATA_PATH'].split(os.pathsep):
28         path = os.path.expandvars(path)
29         path = os.path.expanduser(path)
30         _awscli_data_path.append(path)
31 _awscli_data_path.append(
32     os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
33 )
34 os.environ['AWS_DATA_PATH'] = os.pathsep.join(_awscli_data_path)
35 
36 
37 EnvironmentVariables = {
38     'ca_bundle': ('ca_bundle', 'AWS_CA_BUNDLE', None, None),
39     'output': ('output', 'AWS_DEFAULT_OUTPUT', 'json', None),
40 }
41 
42 
43 SCALAR_TYPES = set([
44     'string', 'float', 'integer', 'long', 'boolean', 'double',
45     'blob', 'timestamp'
46 ])
47 COMPLEX_TYPES = set(['structure', 'map', 'list'])
48
```
--- 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/awscli/__init__.py b/awscli/__init__.py
--- a/awscli/__init__.py
+++ b/awscli/__init__.py
@@ -19,6 +19,16 @@
 
 __version__ = '1.11.80'
 
+
+#
+# Account for LC_CTYPE of UTF-8
+# For more information see:
+#   * http://bugs.python.org/issue18378
+#   * #945
+#
+if os.environ.get('LC_CTYPE', '') == 'UTF-8':
+    os.environ['LC_CTYPE'] = 'en_US.UTF-8'
+
 #
 # Get our data path to be added to botocore's search path
 #
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -44,13 +44,13 @@
     long_description=open('README.rst').read(),
     author='Amazon Web Services',
     url='http://aws.amazon.com/cli/',
-    scripts=['bin/aws', 'bin/aws.cmd',
-             'bin/aws_completer', 'bin/aws_zsh_completer.sh',
+    scripts=['bin/aws_completer', 'bin/aws_zsh_completer.sh',
              'bin/aws_bash_completer'],
     packages=find_packages(exclude=['tests*']),
     package_data={'awscli': ['data/*.json', 'examples/*/*.rst',
                              'examples/*/*/*.rst', 'topics/*.rst',
                              'topics/*.json']},
+    entry_points={"console_scripts": ["aws = awscli.clidriver:main"]},
     install_requires=requires,
     extras_require={
         ':python_version=="2.6"': [

{"golden_diff": "diff --git a/awscli/__init__.py b/awscli/__init__.py\n--- a/awscli/__init__.py\n+++ b/awscli/__init__.py\n@@ -19,6 +19,16 @@\n \n __version__ = '1.11.80'\n \n+\n+#\n+# Account for LC_CTYPE of UTF-8\n+# For more information see:\n+#   * http://bugs.python.org/issue18378\n+#   * #945\n+#\n+if os.environ.get('LC_CTYPE', '') == 'UTF-8':\n+    os.environ['LC_CTYPE'] = 'en_US.UTF-8'\n+\n #\n # Get our data path to be added to botocore's search path\n #\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -44,13 +44,13 @@\n     long_description=open('README.rst').read(),\n     author='Amazon Web Services',\n     url='http://aws.amazon.com/cli/',\n-    scripts=['bin/aws', 'bin/aws.cmd',\n-             'bin/aws_completer', 'bin/aws_zsh_completer.sh',\n+    scripts=['bin/aws_completer', 'bin/aws_zsh_completer.sh',\n              'bin/aws_bash_completer'],\n     packages=find_packages(exclude=['tests*']),\n     package_data={'awscli': ['data/*.json', 'examples/*/*.rst',\n                              'examples/*/*/*.rst', 'topics/*.rst',\n                              'topics/*.json']},\n+    entry_points={\"console_scripts\": [\"aws = awscli.clidriver:main\"]},\n     install_requires=requires,\n     extras_require={\n         ':python_version==\"2.6\"': [\n", "issue": "ImportError on any CLI command on Windows\nHi there,\r\n\r\nI just ran `pip install awscli` in a new Python 2.7 virtual environment on Windows.  It installed successfully, but any command I run gives output like this:\r\n\r\n```\r\n$ aws ecr get-login --region us-east-1\r\nTraceback (most recent call last):\r\n  File \"...\\.tox\\tools\\Scripts\\aws.cmd\", line 50, in <module>\r\n    import awscli.clidriver\r\nImportError: No module named awscli.clidriver\r\n```\r\n\r\nThe package in the virtual environment seems fine and I can run this command successfully (no `ImportError`):\r\n\r\n```\r\n$ python -c \"from awscli.clidriver import main; main()\" ecr get-login --region us-east-1\r\nUnable to locate credentials. You can configure credentials by running \"aws configure\".\r\n```\r\n\r\nAny idea what's wrong?\r\n\r\nI'm using this version:\r\n\r\n```\r\n$ pip freeze | grep awscli\r\nawscli==1.11.36\r\n```\nImportError on any CLI command on Windows\nHi there,\r\n\r\nI just ran `pip install awscli` in a new Python 2.7 virtual environment on Windows.  It installed successfully, but any command I run gives output like this:\r\n\r\n```\r\n$ aws ecr get-login --region us-east-1\r\nTraceback (most recent call last):\r\n  File \"...\\.tox\\tools\\Scripts\\aws.cmd\", line 50, in <module>\r\n    import awscli.clidriver\r\nImportError: No module named awscli.clidriver\r\n```\r\n\r\nThe package in the virtual environment seems fine and I can run this command successfully (no `ImportError`):\r\n\r\n```\r\n$ python -c \"from awscli.clidriver import main; main()\" ecr get-login --region us-east-1\r\nUnable to locate credentials. You can configure credentials by running \"aws configure\".\r\n```\r\n\r\nAny idea what's wrong?\r\n\r\nI'm using this version:\r\n\r\n```\r\n$ pip freeze | grep awscli\r\nawscli==1.11.36\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\nimport codecs\nimport os.path\nimport re\nimport sys\n\nfrom setuptools import setup, find_packages\n\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read(*parts):\n    return codecs.open(os.path.join(here, *parts), 'r').read()\n\n\ndef find_version(*file_paths):\n    version_file = read(*file_paths)\n    version_match = re.search(r\"^__version__ = ['\\\"]([^'\\\"]*)['\\\"]\",\n                              version_file, re.M)\n    if version_match:\n        return version_match.group(1)\n    raise RuntimeError(\"Unable to find version string.\")\n\n\nrequires = ['botocore==1.5.43',\n            'colorama>=0.2.5,<=0.3.7',\n            'docutils>=0.10',\n            'rsa>=3.1.2,<=3.5.0',\n            's3transfer>=0.1.9,<0.2.0',\n            'PyYAML>=3.10,<=3.12']\n\n\nif sys.version_info[:2] == (2, 6):\n    # For python2.6 we have to require argparse since it\n    # was not in stdlib until 2.7.\n    requires.append('argparse>=1.1')\n\n\nsetup_options = dict(\n    name='awscli',\n    version=find_version(\"awscli\", \"__init__.py\"),\n    description='Universal Command Line Environment for AWS.',\n    long_description=open('README.rst').read(),\n    author='Amazon Web Services',\n    url='http://aws.amazon.com/cli/',\n    scripts=['bin/aws', 'bin/aws.cmd',\n             'bin/aws_completer', 'bin/aws_zsh_completer.sh',\n             'bin/aws_bash_completer'],\n    packages=find_packages(exclude=['tests*']),\n    package_data={'awscli': ['data/*.json', 'examples/*/*.rst',\n                             'examples/*/*/*.rst', 'topics/*.rst',\n                             'topics/*.json']},\n    install_requires=requires,\n    extras_require={\n        ':python_version==\"2.6\"': [\n            'argparse>=1.1',\n        ]\n    },\n    license=\"Apache License 2.0\",\n    classifiers=(\n        'Development Status :: 5 - Production/Stable',\n        'Intended Audience :: Developers',\n        'Intended Audience :: System Administrators',\n        'Natural Language :: English',\n        'License :: OSI Approved :: Apache Software License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n    ),\n)\n\nif 'py2exe' in sys.argv:\n    # This will actually give us a py2exe command.\n    import py2exe\n    # And we have some py2exe specific options.\n    setup_options['options'] = {\n        'py2exe': {\n            'optimize': 0,\n            'skip_archive': True,\n            'dll_excludes': ['crypt32.dll'],\n            'packages': ['docutils', 'urllib', 'httplib', 'HTMLParser',\n                         'awscli', 'ConfigParser', 'xml.etree', 'pipes'],\n        }\n    }\n    setup_options['console'] = ['bin/aws']\n\n\nsetup(**setup_options)\n", "path": "setup.py"}, {"content": "# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n#     http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n\"\"\"\nAWSCLI\n----\nA Universal Command Line Environment for Amazon Web Services.\n\"\"\"\nimport os\n\n__version__ = '1.11.80'\n\n#\n# Get our data path to be added to botocore's search path\n#\n_awscli_data_path = []\nif 'AWS_DATA_PATH' in os.environ:\n    for path in os.environ['AWS_DATA_PATH'].split(os.pathsep):\n        path = os.path.expandvars(path)\n        path = os.path.expanduser(path)\n        _awscli_data_path.append(path)\n_awscli_data_path.append(\n    os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')\n)\nos.environ['AWS_DATA_PATH'] = os.pathsep.join(_awscli_data_path)\n\n\nEnvironmentVariables = {\n    'ca_bundle': ('ca_bundle', 'AWS_CA_BUNDLE', None, None),\n    'output': ('output', 'AWS_DEFAULT_OUTPUT', 'json', None),\n}\n\n\nSCALAR_TYPES = set([\n    'string', 'float', 'integer', 'long', 'boolean', 'double',\n    'blob', 'timestamp'\n])\nCOMPLEX_TYPES = set(['structure', 'map', 'list'])\n", "path": "awscli/__init__.py"}], "after_files": [{"content": "#!/usr/bin/env python\nimport codecs\nimport os.path\nimport re\nimport sys\n\nfrom setuptools import setup, find_packages\n\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read(*parts):\n    return codecs.open(os.path.join(here, *parts), 'r').read()\n\n\ndef find_version(*file_paths):\n    version_file = read(*file_paths)\n    version_match = re.search(r\"^__version__ = ['\\\"]([^'\\\"]*)['\\\"]\",\n                              version_file, re.M)\n    if version_match:\n        return version_match.group(1)\n    raise RuntimeError(\"Unable to find version string.\")\n\n\nrequires = ['botocore==1.5.43',\n            'colorama>=0.2.5,<=0.3.7',\n            'docutils>=0.10',\n            'rsa>=3.1.2,<=3.5.0',\n            's3transfer>=0.1.9,<0.2.0',\n            'PyYAML>=3.10,<=3.12']\n\n\nif sys.version_info[:2] == (2, 6):\n    # For python2.6 we have to require argparse since it\n    # was not in stdlib until 2.7.\n    requires.append('argparse>=1.1')\n\n\nsetup_options = dict(\n    name='awscli',\n    version=find_version(\"awscli\", \"__init__.py\"),\n    description='Universal Command Line Environment for AWS.',\n    long_description=open('README.rst').read(),\n    author='Amazon Web Services',\n    url='http://aws.amazon.com/cli/',\n    scripts=['bin/aws_completer', 'bin/aws_zsh_completer.sh',\n             'bin/aws_bash_completer'],\n    packages=find_packages(exclude=['tests*']),\n    package_data={'awscli': ['data/*.json', 'examples/*/*.rst',\n                             'examples/*/*/*.rst', 'topics/*.rst',\n                             'topics/*.json']},\n    entry_points={\"console_scripts\": [\"aws = awscli.clidriver:main\"]},\n    install_requires=requires,\n    extras_require={\n        ':python_version==\"2.6\"': [\n            'argparse>=1.1',\n        ]\n    },\n    license=\"Apache License 2.0\",\n    classifiers=(\n        'Development Status :: 5 - Production/Stable',\n        'Intended Audience :: Developers',\n        'Intended Audience :: System Administrators',\n        'Natural Language :: English',\n        'License :: OSI Approved :: Apache Software License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n    ),\n)\n\nif 'py2exe' in sys.argv:\n    # This will actually give us a py2exe command.\n    import py2exe\n    # And we have some py2exe specific options.\n    setup_options['options'] = {\n        'py2exe': {\n            'optimize': 0,\n            'skip_archive': True,\n            'dll_excludes': ['crypt32.dll'],\n            'packages': ['docutils', 'urllib', 'httplib', 'HTMLParser',\n                         'awscli', 'ConfigParser', 'xml.etree', 'pipes'],\n        }\n    }\n    setup_options['console'] = ['bin/aws']\n\n\nsetup(**setup_options)\n", "path": "setup.py"}, {"content": "# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n#     http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\n\"\"\"\nAWSCLI\n----\nA Universal Command Line Environment for Amazon Web Services.\n\"\"\"\nimport os\n\n__version__ = '1.11.80'\n\n\n#\n# Account for LC_CTYPE of UTF-8\n# For more information see:\n#   * http://bugs.python.org/issue18378\n#   * #945\n#\nif os.environ.get('LC_CTYPE', '') == 'UTF-8':\n    os.environ['LC_CTYPE'] = 'en_US.UTF-8'\n\n#\n# Get our data path to be added to botocore's search path\n#\n_awscli_data_path = []\nif 'AWS_DATA_PATH' in os.environ:\n    for path in os.environ['AWS_DATA_PATH'].split(os.pathsep):\n        path = os.path.expandvars(path)\n        path = os.path.expanduser(path)\n        _awscli_data_path.append(path)\n_awscli_data_path.append(\n    os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')\n)\nos.environ['AWS_DATA_PATH'] = os.pathsep.join(_awscli_data_path)\n\n\nEnvironmentVariables = {\n    'ca_bundle': ('ca_bundle', 'AWS_CA_BUNDLE', None, None),\n    'output': ('output', 'AWS_DEFAULT_OUTPUT', 'json', None),\n}\n\n\nSCALAR_TYPES = set([\n    'string', 'float', 'integer', 'long', 'boolean', 'double',\n    'blob', 'timestamp'\n])\nCOMPLEX_TYPES = set(['structure', 'map', 'list'])\n", "path": "awscli/__init__.py"}]}