Type error in python 3.6
See original GitHub issueI get an error when I run migration in python-3.6
Traceback (most recent call last):
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/__init__.py", line 92, in run
Main(config).execute()
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/main.py", line 50, in execute
self._execution_log('\nStarting DB migration on host/database "%s/%s" with user "%s"...' % (self.config.get('database_host'), self.config.get('database_name'), self.config.get('database_user')), "PINK", log_level_limit=1)
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/main.py", line 254, in _execution_log
CLI.msg(msg, color)
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/cli.py", line 243, in msg
print("{}{}{}".format(cls.color[color], msg, cls.color["END"]))
File "/Users/rajeev/Workspace/procure/procure-backend/bin/../lib/python3.6/codecs.py", line 377, in write
self.stream.write(data)
TypeError: write() argument must be str, not bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/rajeev/Workspace/procure/procure-backend/bin/db-migrate", line 11, in <module>
sys.exit(run_from_argv())
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/__init__.py", line 18, in run_from_argv
run(options.__dict__)
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/__init__.py", line 96, in run
CLI.error_and_exit(str(e))
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/cli.py", line 233, in error_and_exit
cls.msg("[ERROR] %s\n" % msg, "RED")
File "/Users/rajeev/Workspace/procure/procure-backend/lib/python3.6/site-packages/simple_db_migrate/cli.py", line 243, in msg
print("{}{}{}".format(cls.color[color], msg, cls.color["END"]))
File "/Users/rajeev/Workspace/procure/procure-backend/bin/../lib/python3.6/codecs.py", line 377, in write
self.stream.write(data)
TypeError: write() argument must be str, not bytes
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
8. Errors and Exceptions — Python 3.11.1 documentation
The last line of the error message indicates what happened. Exceptions come in different types, and the type is printed as part of...
Read more >5. Built-in Exceptions — Python 3.6.3 documentation
User code can raise built-in exceptions. This can be used to test an exception handler or to report an error condition “just like”...
Read more >Type error in python 3.6: Must be string not int - Stack Overflow
This will fix your issue as the int() function will cast the string to an int and then you should be able to...
Read more >Python 3 - Exceptions Handling - Tutorialspoint
Standard Exceptions ; 26. TypeError. Raised when an operation or function is attempted that is invalid for the specified data type. ; 27....
Read more >T164163 TestScriptHelp.test_imagecopy fails in python 3.6 ...
TestScriptHelp.test_imagecopy fails in python 3.6 with "TypeError: NoneType takes no arguments". Closed, ResolvedPublic. Actions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like the problem is LC_CTYPE. I added the below export in my bash profile and the problem seems to be resolved.
export LC_CTYPE=UTF-8
Try this if above doesn’t work
export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8