We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Mac App MySQL installations failing based on "Incorrect string value"
MCDB:

```
INSERT INTO MCDB.trapping (site_id, initial_year, final_year, n_sampling_months, trap_nights, months_of_sampling, pitfall_traps, small_traps, large_traps, snap_traps, notes) VALUES (1206, '1995', '1995', '1', '580', 'November', '1', '0', '0', '0', 'each pitfall trapline 100-500 m?; unclear how many or length');
(1366, "Incorrect string value: '\\xB2; unc...' for column 'notes' at row 1")
```

MarineSize (Barnes 2008):

```
INSERT INTO MarineSize.main (record_number, in_ref_id, individual_id, predator, predator_common_name, predator_taxon, predator_lifestage, type_of_feeding_interaction, predator_length, predator_length_unit, predator_dimension_measured, predator_standard_length, predator_fork_length, predator_total_length, predator_tl_fl_sl_conversion_reference, standardised_predator_length, predator_measurement_type, predator_length_mass_conversion_method, predator_length_mass_conversion_reference, predator_quality_of_length_mass_conversion, predator_mass, predator_mass_unit, predator_mass_check, predator_mass_check_diff, predator_ratio_mass_mass, si_predator_mass, diet_coverage, prey, prey_common_name, prey_taxon, prey_length, prey_length_unit, prey_conversion_to_length_method, prey_quality_of_conversion_to_length, prey_conversion_to_length_reference, si_prey_length, prey_dimension_measured, prey_width, prey_width_unit, prey_measurement_type, prey_mass, prey_mass_unit, prey_mass_check, prey_mass_check_diff, prey_ratio_mass_mass, si_prey_mass, prey_conversion_to_mass_method, prey_conversion_to_mass_reference, prey_quality_of_conversion_to_mass, geographic_location, latitude, lonitude, depth, mean_annual_temp, sd_annual_temp, mean_pp, sd_pp, reference, specific_habitat, notes_assumptions) VALUES (1, 'ATSH063', 1, 'Rhizoprionodon terraenovae', 'Atlantic sharpnose shark', 'ectotherm vertebrate', 'adult', 'predacious/piscivorous', 7.8000E+02, 'mm', 'fork length', 7.5433E+02, 7.8000E+02, 9.3990E+02, 'Fishbase (species)', 9.3990E+01, 'individual', 'M=0.0056SL^2.897', 'Bonfil et al. (1990)', 1, 1.5399E+03, 'g', 4.3453E+04, 4.1913E+04, 2.8218E+01, 1.5399E+03, 'all', 'teleosts/molluscs/crustaceans', 'teleosts/molluscs/crustaceans', 'mixed', 1.1259E+02, 'mm', null, 0, null, 1.1259E+01, 'length', null, null, 'individual', 1.4274E+01, 'g', 7.4699E+01, 6.0425E+01, 5.2333E+00, 1.4274E+01, 'M=0.01L^3', 'Generalised', 5, 'Apalachicola Bay, Florida', '29?40\'N', '85?10\'W', 30, 24.1, 4.2, 866, 214, 'Bethea et al (2004)', 'Coastal Bay', null);
(1366, "Incorrect string value: '\\xBA40'N' for column 'latitude' at row 1")
```

McGlinn2010:

```
INSERT INTO McGlinn2010.species (spnum, spcode, family, genus, species, variety, subspecies, spname, binomia_auth, trinomial_auth) VALUES (257, 'seneplat', 'Asteraceae', 'Packera', 'plattensis', '', '', 'Packera plattensis', '(Nutt.) W.A. Weber & A. L?ve', '');
(1366, "Incorrect string value: '\\xF6ve' for column 'binomia_auth' at row 1")
```

All of these datasets install fine using the source installation. When using the .app build from the CLI they also all report:

```
Couldn't create database (unsupported operand type(s) for +: 'NoneType' and 'str'). Trying to continue anyway.
```

but this appears to be reported by all of the datasets, including those that are successfully installed.


--- 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 """Use the following command to install retriever: python setup.py install"""
2 
3 from setuptools import setup
4 import platform
5 
6 p = platform.platform().lower()
7 extra_includes = []
8 if "darwin" in p:
9     try: import py2app
10     except ImportError: pass
11     extra_includes = []
12 elif "win" in p:
13     try: import py2exe
14     except ImportError: pass
15     import sys
16     extra_includes = ['pyodbc', 'inspect']
17     sys.path.append("C:\\Windows\\winsxs\\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91")
18 from __init__ import VERSION
19 
20 
21 def clean_version(v):
22     if v == 'master':
23         return '1.0.0'
24     return v.replace('v', '').replace('.rc', '').replace('.beta', '')
25 
26 packages = [
27             'retriever.lib',
28             'retriever.engines',
29             'retriever.app',
30             'retriever',
31             ]
32 
33 try:
34     import pymysql
35     mysql_module = 'pymysql'
36 except ImportError:
37     try:
38         import MySQLdb
39         mysql_module = 'MySQLdb'
40     except ImportError:
41         mysql_module = 'pymysql'
42 
43 includes = [
44             'xlrd',
45             'wx',
46             mysql_module,
47             'psycopg2',
48             'sqlite3',
49             ] + extra_includes
50             
51 excludes = [
52             'pyreadline',
53             'doctest',
54             'optparse',
55             'getopt',
56             'pickle',
57             'calendar',
58             'pdb',
59             'inspect',
60             'email',
61             'pywin', 'pywin.debugger',
62             'pywin.debugger.dbgcon',
63             'pywin.dialogs', 'pywin.dialogs.list',
64             'Tkconstants', 'Tkinter', 'tcl',
65             ]
66 
67 
68 setup(name='retriever',
69       version=clean_version(VERSION),
70       description='EcoData Retriever',
71       author='Ben Morris',
72       author_email='ben.morris@weecology.org',
73       url='http://www.ecodataretriever.org',
74       packages=packages,
75       package_dir={
76                 'retriever':''
77                 },
78       entry_points={
79         'console_scripts': [
80             'retriever = retriever.__main__:main',
81         ],
82       },
83       install_requires=[
84                         'xlrd',
85                         ],
86 
87       # py2exe flags
88       console = [{'script': "__main__.py",
89                   'dest_base': "retriever",
90                   'icon_resources':[(1,'icon.ico')]
91                   }],
92       zipfile = None,
93 
94       # py2app flags
95       app=['__main__.py'],
96       data_files=[('', ['CITATION'])],
97       setup_requires=['py2app'] if 'darwin' in p else [],
98 
99       # options
100       options = {'py2exe': {'bundle_files': 1,
101                             'compressed': 2,
102                             'optimize': 2,
103                             'packages': packages,
104                             'includes': includes,
105                             'excludes': excludes,
106                             },
107                  'py2app': {'packages': ['retriever'],
108                             'includes': includes,
109                             'site_packages': True,
110                             'resources': [],
111                             'optimize': 2,
112                             'argv_emulation': True,
113                             'no_chdir': True,
114                             },
115                 },
116       )
117 
118 
119 try:
120     from compile import compile
121     compile()
122 except:
123     pass
124
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -97,6 +97,7 @@
       setup_requires=['py2app'] if 'darwin' in p else [],
 
       # options
+      # optimize is set to 1 of py2app to avoid errors with pymysql
       options = {'py2exe': {'bundle_files': 1,
                             'compressed': 2,
                             'optimize': 2,
@@ -108,7 +109,7 @@
                             'includes': includes,
                             'site_packages': True,
                             'resources': [],
-                            'optimize': 2,
+                            'optimize': 1,
                             'argv_emulation': True,
                             'no_chdir': True,
                             },

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -97,6 +97,7 @@\n       setup_requires=['py2app'] if 'darwin' in p else [],\n \n       # options\n+      # optimize is set to 1 of py2app to avoid errors with pymysql\n       options = {'py2exe': {'bundle_files': 1,\n                             'compressed': 2,\n                             'optimize': 2,\n@@ -108,7 +109,7 @@\n                             'includes': includes,\n                             'site_packages': True,\n                             'resources': [],\n-                            'optimize': 2,\n+                            'optimize': 1,\n                             'argv_emulation': True,\n                             'no_chdir': True,\n                             },\n", "issue": "Mac App MySQL installations failing based on \"Incorrect string value\"\nMCDB:\n\n```\nINSERT INTO MCDB.trapping (site_id, initial_year, final_year, n_sampling_months, trap_nights, months_of_sampling, pitfall_traps, small_traps, large_traps, snap_traps, notes) VALUES (1206, '1995', '1995', '1', '580', 'November', '1', '0', '0', '0', 'each pitfall trapline 100-500 m?; unclear how many or length');\n(1366, \"Incorrect string value: '\\\\xB2; unc...' for column 'notes' at row 1\")\n```\n\nMarineSize (Barnes 2008):\n\n```\nINSERT INTO MarineSize.main (record_number, in_ref_id, individual_id, predator, predator_common_name, predator_taxon, predator_lifestage, type_of_feeding_interaction, predator_length, predator_length_unit, predator_dimension_measured, predator_standard_length, predator_fork_length, predator_total_length, predator_tl_fl_sl_conversion_reference, standardised_predator_length, predator_measurement_type, predator_length_mass_conversion_method, predator_length_mass_conversion_reference, predator_quality_of_length_mass_conversion, predator_mass, predator_mass_unit, predator_mass_check, predator_mass_check_diff, predator_ratio_mass_mass, si_predator_mass, diet_coverage, prey, prey_common_name, prey_taxon, prey_length, prey_length_unit, prey_conversion_to_length_method, prey_quality_of_conversion_to_length, prey_conversion_to_length_reference, si_prey_length, prey_dimension_measured, prey_width, prey_width_unit, prey_measurement_type, prey_mass, prey_mass_unit, prey_mass_check, prey_mass_check_diff, prey_ratio_mass_mass, si_prey_mass, prey_conversion_to_mass_method, prey_conversion_to_mass_reference, prey_quality_of_conversion_to_mass, geographic_location, latitude, lonitude, depth, mean_annual_temp, sd_annual_temp, mean_pp, sd_pp, reference, specific_habitat, notes_assumptions) VALUES (1, 'ATSH063', 1, 'Rhizoprionodon terraenovae', 'Atlantic sharpnose shark', 'ectotherm vertebrate', 'adult', 'predacious/piscivorous', 7.8000E+02, 'mm', 'fork length', 7.5433E+02, 7.8000E+02, 9.3990E+02, 'Fishbase (species)', 9.3990E+01, 'individual', 'M=0.0056SL^2.897', 'Bonfil et al. (1990)', 1, 1.5399E+03, 'g', 4.3453E+04, 4.1913E+04, 2.8218E+01, 1.5399E+03, 'all', 'teleosts/molluscs/crustaceans', 'teleosts/molluscs/crustaceans', 'mixed', 1.1259E+02, 'mm', null, 0, null, 1.1259E+01, 'length', null, null, 'individual', 1.4274E+01, 'g', 7.4699E+01, 6.0425E+01, 5.2333E+00, 1.4274E+01, 'M=0.01L^3', 'Generalised', 5, 'Apalachicola Bay, Florida', '29?40\\'N', '85?10\\'W', 30, 24.1, 4.2, 866, 214, 'Bethea et al (2004)', 'Coastal Bay', null);\n(1366, \"Incorrect string value: '\\\\xBA40'N' for column 'latitude' at row 1\")\n```\n\nMcGlinn2010:\n\n```\nINSERT INTO McGlinn2010.species (spnum, spcode, family, genus, species, variety, subspecies, spname, binomia_auth, trinomial_auth) VALUES (257, 'seneplat', 'Asteraceae', 'Packera', 'plattensis', '', '', 'Packera plattensis', '(Nutt.) W.A. Weber & A. L?ve', '');\n(1366, \"Incorrect string value: '\\\\xF6ve' for column 'binomia_auth' at row 1\")\n```\n\nAll of these datasets install fine using the source installation. When using the .app build from the CLI they also all report:\n\n```\nCouldn't create database (unsupported operand type(s) for +: 'NoneType' and 'str'). Trying to continue anyway.\n```\n\nbut this appears to be reported by all of the datasets, including those that are successfully installed.\n\n", "before_files": [{"content": "\"\"\"Use the following command to install retriever: python setup.py install\"\"\"\n\nfrom setuptools import setup\nimport platform\n\np = platform.platform().lower()\nextra_includes = []\nif \"darwin\" in p:\n    try: import py2app\n    except ImportError: pass\n    extra_includes = []\nelif \"win\" in p:\n    try: import py2exe\n    except ImportError: pass\n    import sys\n    extra_includes = ['pyodbc', 'inspect']\n    sys.path.append(\"C:\\\\Windows\\\\winsxs\\\\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\")\nfrom __init__ import VERSION\n\n\ndef clean_version(v):\n    if v == 'master':\n        return '1.0.0'\n    return v.replace('v', '').replace('.rc', '').replace('.beta', '')\n\npackages = [\n            'retriever.lib',\n            'retriever.engines',\n            'retriever.app',\n            'retriever',\n            ]\n\ntry:\n    import pymysql\n    mysql_module = 'pymysql'\nexcept ImportError:\n    try:\n        import MySQLdb\n        mysql_module = 'MySQLdb'\n    except ImportError:\n        mysql_module = 'pymysql'\n\nincludes = [\n            'xlrd',\n            'wx',\n            mysql_module,\n            'psycopg2',\n            'sqlite3',\n            ] + extra_includes\n            \nexcludes = [\n            'pyreadline',\n            'doctest',\n            'optparse',\n            'getopt',\n            'pickle',\n            'calendar',\n            'pdb',\n            'inspect',\n            'email',\n            'pywin', 'pywin.debugger',\n            'pywin.debugger.dbgcon',\n            'pywin.dialogs', 'pywin.dialogs.list',\n            'Tkconstants', 'Tkinter', 'tcl',\n            ]\n\n\nsetup(name='retriever',\n      version=clean_version(VERSION),\n      description='EcoData Retriever',\n      author='Ben Morris',\n      author_email='ben.morris@weecology.org',\n      url='http://www.ecodataretriever.org',\n      packages=packages,\n      package_dir={\n                'retriever':''\n                },\n      entry_points={\n        'console_scripts': [\n            'retriever = retriever.__main__:main',\n        ],\n      },\n      install_requires=[\n                        'xlrd',\n                        ],\n\n      # py2exe flags\n      console = [{'script': \"__main__.py\",\n                  'dest_base': \"retriever\",\n                  'icon_resources':[(1,'icon.ico')]\n                  }],\n      zipfile = None,\n\n      # py2app flags\n      app=['__main__.py'],\n      data_files=[('', ['CITATION'])],\n      setup_requires=['py2app'] if 'darwin' in p else [],\n\n      # options\n      options = {'py2exe': {'bundle_files': 1,\n                            'compressed': 2,\n                            'optimize': 2,\n                            'packages': packages,\n                            'includes': includes,\n                            'excludes': excludes,\n                            },\n                 'py2app': {'packages': ['retriever'],\n                            'includes': includes,\n                            'site_packages': True,\n                            'resources': [],\n                            'optimize': 2,\n                            'argv_emulation': True,\n                            'no_chdir': True,\n                            },\n                },\n      )\n\n\ntry:\n    from compile import compile\n    compile()\nexcept:\n    pass\n", "path": "setup.py"}], "after_files": [{"content": "\"\"\"Use the following command to install retriever: python setup.py install\"\"\"\n\nfrom setuptools import setup\nimport platform\n\np = platform.platform().lower()\nextra_includes = []\nif \"darwin\" in p:\n    try: import py2app\n    except ImportError: pass\n    extra_includes = []\nelif \"win\" in p:\n    try: import py2exe\n    except ImportError: pass\n    import sys\n    extra_includes = ['pyodbc', 'inspect']\n    sys.path.append(\"C:\\\\Windows\\\\winsxs\\\\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91\")\nfrom __init__ import VERSION\n\n\ndef clean_version(v):\n    if v == 'master':\n        return '1.0.0'\n    return v.replace('v', '').replace('.rc', '').replace('.beta', '')\n\npackages = [\n            'retriever.lib',\n            'retriever.engines',\n            'retriever.app',\n            'retriever',\n            ]\n\ntry:\n    import pymysql\n    mysql_module = 'pymysql'\nexcept ImportError:\n    try:\n        import MySQLdb\n        mysql_module = 'MySQLdb'\n    except ImportError:\n        mysql_module = 'pymysql'\n\nincludes = [\n            'xlrd',\n            'wx',\n            mysql_module,\n            'psycopg2',\n            'sqlite3',\n            ] + extra_includes\n            \nexcludes = [\n            'pyreadline',\n            'doctest',\n            'optparse',\n            'getopt',\n            'pickle',\n            'calendar',\n            'pdb',\n            'inspect',\n            'email',\n            'pywin', 'pywin.debugger',\n            'pywin.debugger.dbgcon',\n            'pywin.dialogs', 'pywin.dialogs.list',\n            'Tkconstants', 'Tkinter', 'tcl',\n            ]\n\n\nsetup(name='retriever',\n      version=clean_version(VERSION),\n      description='EcoData Retriever',\n      author='Ben Morris',\n      author_email='ben.morris@weecology.org',\n      url='http://www.ecodataretriever.org',\n      packages=packages,\n      package_dir={\n                'retriever':''\n                },\n      entry_points={\n        'console_scripts': [\n            'retriever = retriever.__main__:main',\n        ],\n      },\n      install_requires=[\n                        'xlrd',\n                        ],\n\n      # py2exe flags\n      console = [{'script': \"__main__.py\",\n                  'dest_base': \"retriever\",\n                  'icon_resources':[(1,'icon.ico')]\n                  }],\n      zipfile = None,\n\n      # py2app flags\n      app=['__main__.py'],\n      data_files=[('', ['CITATION'])],\n      setup_requires=['py2app'] if 'darwin' in p else [],\n\n      # options\n      # optimize is set to 1 of py2app to avoid errors with pymysql\n      options = {'py2exe': {'bundle_files': 1,\n                            'compressed': 2,\n                            'optimize': 2,\n                            'packages': packages,\n                            'includes': includes,\n                            'excludes': excludes,\n                            },\n                 'py2app': {'packages': ['retriever'],\n                            'includes': includes,\n                            'site_packages': True,\n                            'resources': [],\n                            'optimize': 1,\n                            'argv_emulation': True,\n                            'no_chdir': True,\n                            },\n                },\n      )\n\n\ntry:\n    from compile import compile\n    compile()\nexcept:\n    pass\n", "path": "setup.py"}]}