cairocffi

結局 x86_64 でhomebrew 作り直し anyenv, python を入れ直し https://qiita.com/ktgw0316/items/b5358a471ae9ee84f771 arch -arch x86_64 zsh で x86_64 環境で作業する % uname -m x86_64 問題 % pip install cairocffi lCollecting cairocffi Downloading cairocffi-1.2.0.tar.gz (70 kB) ( |████████████████████████████████| 70 kB 5.4 MB/s ERROR: Command errored out with exit status 1: command: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-instal l-uxwwpx3n/cairocffi_949ddafebb174433b898b1d60614bf77/setup.py'"'"'; __file__='"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_949ddafebb174433b898b1d60614bf77/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compi le(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-pip-egg-info-952byczr cwd: /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_949ddafebb174433b898b1d60614bf77/ Complete output (31 lines): WARNING: The wheel package is not available. Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_949ddafebb174433b898b1d60614bf77/setup.py", line 10, in <module> setup( File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 434, in __init__ _Distribution.__init__(self, { File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/dist.py", line 292, in __init__ self.finalize_options() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 743, in finalize_options ep(self) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 750, in _finalize_setup_keywords ep.load()(self, ep.name, value) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules add_cffi_module(dist, cffi_module) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module execfile(build_file_name, mod_vars) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile exec(code, glob, glob) File "cairocffi/ffi_build.py", line 26, in <module> ffi = FFI() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__ import _cffi_backend as backend ImportError: dlopen(/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 2): Symbol not found: _ffi_prep_closure 9 Referenced from: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so Expected in: flat namespace in /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/84/ca/0bffed5116d21251469df200448667e90acaa5131edea869b44a3fbc73d0/cairocffi-1.2.0.tar.gz#sha256=9a979b500c64c8179fec286f337e8fe644eca2f2cd05860ce0b62d25f22ea14 0 (from https://pypi.org/simple/cairocffi/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading cairocffi-1.1.0.tar.gz (68 kB) |████████████████████████████████| 68 kB 41.2 MB/s ERROR: Command errored out with exit status 1: command: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-instal l-uxwwpx3n/cairocffi_0871e9b26c6442869a897d8d8df7ca3f/setup.py'"'"'; __file__='"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_0871e9b26c6442869a897d8d8df7ca3f/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compi le(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-pip-egg-info-2h4amr27 cwd: /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_0871e9b26c6442869a897d8d8df7ca3f/ Complete output (31 lines): WARNING: The wheel package is not available. Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_0871e9b26c6442869a897d8d8df7ca3f/setup.py", line 10, in <module> setup( File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 434, in __init__ _Distribution.__init__(self, { File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/dist.py", line 292, in __init__ self.finalize_options() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 743, in finalize_options ep(self) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 750, in _finalize_setup_keywords ep.load()(self, ep.name, value) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules add_cffi_module(dist, cffi_module) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module execfile(build_file_name, mod_vars) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile exec(code, glob, glob) File "cairocffi/ffi_build.py", line 26, in <module> ffi = FFI() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__ import _cffi_backend as backend ImportError: dlopen(/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 2): Symbol not found: _ffi_prep_closure Referenced from: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so Expected in: flat namespace in /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/f7/99/b3a2c6393563ccbe081ffcceb359ec27a6227792c5169604c1bd8128031a/cairocffi-1.1.0.tar.gz#sha256=f1c0c5878f74ac9ccb5d48b2601fcc75390c881ce476e79f4cfedd288b1b05d b (from https://pypi.org/simple/cairocffi/) (requires-python:>= 3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading cairocffi-1.0.2.tar.gz (68 kB) [24/677] |████████████████████████████████| 68 kB 46.3 MB/s ERROR: Command errored out with exit status 1: command: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-instal l-uxwwpx3n/cairocffi_6df35727083e4413bfaa3e41ad38bc09/setup.py'"'"'; __file__='"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_6df35727083e4413bfaa3e41ad38bc09/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compi le(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-pip-egg-info-wdq78cuo cwd: /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_6df35727083e4413bfaa3e41ad38bc09/ Complete output (31 lines): WARNING: The wheel package is not available. Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_6df35727083e4413bfaa3e41ad38bc09/setup.py", line 10, in <module> setup( File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 434, in __init__ _Distribution.__init__(self, { File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/dist.py", line 292, in __init__ self.finalize_options() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 743, in finalize_options ep(self) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 750, in _finalize_setup_keywords ep.load()(self, ep.name, value) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules add_cffi_module(dist, cffi_module) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module execfile(build_file_name, mod_vars) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile exec(code, glob, glob) File "cairocffi/ffi_build.py", line 26, in <module> ffi = FFI() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__ import _cffi_backend as backend ImportError: dlopen(/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 2): Symbol not found: _ffi_prep_closure Referenced from: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so Expected in: flat namespace in /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/0f/0f/7e21b5ddd31b610e46a879c0d21e222dd0fef428c1fc86bbd2bd57fed8a7/cairocffi-1.0.2.tar.gz#sha256=01ac51ae12c4324ca5809ce270f9dd1b67f5166fe63bd3e497e9ea3ca91946f f (from https://pypi.org/simple/cairocffi/) (requires-python:>= 3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading cairocffi-1.0.1.tar.gz (68 kB) |████████████████████████████████| 68 kB 48.1 MB/s ERROR: Command errored out with exit status 1: command: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-instal l-uxwwpx3n/cairocffi_60641da3bfa74b2abbdcfd8f77811245/setup.py'"'"'; __file__='"'"'/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_60641da3bfa74b2abbdcfd8f77811245/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compi le(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-pip-egg-info-d6t_qnin cwd: /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_60641da3bfa74b2abbdcfd8f77811245/ Complete output (31 lines): WARNING: The wheel package is not available. Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/pip-install-uxwwpx3n/cairocffi_60641da3bfa74b2abbdcfd8f77811245/setup.py", line 10, in <module> setup( File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 434, in __init__ _Distribution.__init__(self, { File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/lib/python3.9/distutils/dist.py", line 292, in __init__ self.finalize_options() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 743, in finalize_options ep(self) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/setuptools/dist.py", line 750, in _finalize_setup_keywords ep.load()(self, ep.name, value) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules add_cffi_module(dist, cffi_module) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module execfile(build_file_name, mod_vars) File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/setuptools_ext.py", line 25, in execfile exec(code, glob, glob) File "cairocffi/ffi_build.py", line 26, in <module> ffi = FFI() File "/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/cffi/api.py", line 48, in __init__ import _cffi_backend as backend ImportError: dlopen(/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 2): Symbol not found: _ffi_prep_closure Referenced from: /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so Expected in: flat namespace in /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/3e/f1/0d1dad825f6ec75d3d79d5673e7b836e7a23bf57fde0028fb8bf252d4259/cairocffi-1.0.1.tar.gz#sha256=9ca49d9bb0a52bd6a8263de137b4818e0889f3cd8d933165fb122669924ae3b 9 (from https://pypi.org/simple/cairocffi/) (requires-python:>= 3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading cairocffi-1.0.0-py3-none-any.whl (88 kB) |████████████████████████████████| 88 kB 52.9 MB/s Requirement already satisfied: cffi>=1.1.0 in /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages (from cairocffi) (1.14.5) Requirement already satisfied: pycparser in /Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/envs/coresys/lib/python3.9/site-packages (from cffi>=1.1.0->cairocffi) (2.20) Installing collected packages: cairocffi Successfully installed cairocffi-1.0.0

2021年8月27日 · 5 分

pyenv install 3.9.6

% pyenv install 3.9.6 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.9.6.tar.xz... -> https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz Installing Python-3.9.6... python-build: use readline from homebrew python-build: use zlib from xcode sdk WARNING: The Python readline extension was not compiled. Missing the GNU readline lib? ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? Please consult to the Wiki page to fix the problem. https://github.com/pyenv/pyenv/wiki/Common-build-problems BUILD FAILED (OS X 11.5.2 using python-build 2.0.5-2-gb2eb2d28) Inspect or clean up the working tree at /var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/python-build.20210827141959.69396 Results logged to /var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/python-build.20210827141959.69396.log Last 10 log lines: ./python.exe -E -m ensurepip \ $ensurepip --root=/ ; \ fi Looking in links: /var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/tmp24q45onf Processing /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/tmp24q45onf/setuptools-56.0.0-py3-none-any.whl Processing /private/var/folders/m0/27vm0kbd5ys1_rs1l54zmwq00000gq/T/tmp24q45onf/pip-21.1.3-py3-none-any.whl Installing collected packages: setuptools, pip WARNING: The scripts pip3 and pip3.9 are installed in '/Users/hdknr/.anyenv/envs/pyenv/versions/3.9.6/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-21.1.3 setuptools-56.0.0

2021年8月27日 · 1 分

Django: asgiref

asgiref https://github.com/django/asgiref ASGI: ASGI is a standard for Python asynchronous web apps and servers to communicate with each other, and positioned as an asynchronous successor to WSGI. You can read more at https://asgi.readthedocs.io/en/latest/ This package includes ASGI base libraries, such as: Sync-to-async and async-to-sync function wrappers, asgiref.sync Server base classes, asgiref.server A WSGI-to-ASGI adapter, in asgiref.wsgi Function wrappers These allow you to wrap or decorate async or sync functions to call them from the other style (so you can call async functions from a synchronous thread, or vice-versa). ...

2021年6月2日 · 3 分

Python: singledispatch

singledispatch PEP 443 – Single-dispatch generic functions single-dispatch generic functions : form of generic programming 記事 Generic Function in Python with Singledispatch

2021年5月24日 · 1 分

Python:Exception

Python: Exception Python Exceptions: An Introduction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 try: # 処理 linux_interaction() except AssertionError as error: # 例外 print(error) else: ## 例外がない場合 try: with open('file.log') as file: read_data = file.read() except FileNotFoundError as fnf_error: print(fnf_error) finally: # 最後に必ず実行 print('Cleaning up, irrespective of any exceptions.') Python Exception Base Classes 組み込み例外 8.6. ユーザー定義例外

2021年5月14日 · 1 分

Django: Request.encodingについて

HttpRequest.encoding django.http.request.HttpRequest cgi.parse_header で、Content-Typeヘッダーから content_type と content_params(dict) を取得。 conent_paramsに charset が入っている可能性がある codecs.lookup を使って、charset の存在を確認。 存在したらHttpRequest.encodingプロパティに設定する 実態は, HttpRequest._encoding

2021年4月24日 · 1 分

DRF: CSVを送信するするときに WindowsだとBOMをつけないとExcelで文字化けする問題

BOM(byte order mark) ファイルの先頭3バイトが ‘EF BB BF’ の UTF-8 rest_framework_csv rendererで、 コンテキストの encoding を判定している encodingに utf-8-sig を 指定する viewset: get_renderer_context をオーバーライドする 1 2 3 4 5 6 7 8 9 10 11 def get_renderer_context(self): """(override)""" context = super().get_renderer_context() # ここで、以下の条件の時に utf-8-sigにセット # 1) text/csv を求めている # 2) utf-8 でエンコードが指定されている(デフォルト) if self.request.META.get('HTTP_ACCEPT', '').startswith('text/csv'): context['encoding'] = 'utf-8-sig' return context 記事 bom付きutf-8に変換するnkfコマンド PythonでUTF-8 with BOMを開く Declaring character encodings in HTML The byte-order mark (BOM) in HTML Accept-Encoding HttpRequest.META

2021年4月24日 · 1 分

OSC

https://www.music.mcgill.ca/~gary/306/week9/osc.html http://opensoundcontrol.org/ https://pypi.org/project/python-osc/ https://techracho.bpsinc.jp/katayama-yuuki/2017_07_13/42884 https://github.com/colinbdclark/osc.js https://github.com/ValdemarOrn/SharpOSC

2020年11月17日 · 1 分

CentOS

$ sudo yum install graphviz-python graphviz-devel $ pip install pygraphviz

2015年8月4日 · 1 分

Geolocation

Google Maps API googlemaps/google-maps-services-python Google Geocoding API で住所から緯度経度を求める

2015年8月1日 · 1 分