python:locale — internationalization service

python: locale — internationalization service Introduction Background, details, tips, tricks and considerations For extension writers and programs that run embedded in Python access message catalog Introduction The locale module enables access to POSIX localization databases and functions. POSIX localization mechanisms allow programmers to handle certain localization issues for applications without having to know all the […]

[Solved] pytorch1.8 reports UnboundLocalError: local variable ‘beta1’ referenced before assignment (adamw.py)

In the error report of calling the adamw loss function, it is found that the adamw source code in pytoch1.8 is wrong, and pytorch officially fixed this error in version 1.9, so just replace it with the code in 1.9. Path /home/djy/anaconda3/envs/petr/lib/python3.8/site-packages/torch/optim/adamw.py import torch from . import _functional as F from .optimizer import Optimizer class […]

[Solved] Error record: Remote sensing image does extreme value operation: UnboundLocalError: local variable ‘x_nor’ referenced before assignment

Using Python + gdal to perform extreme value operations on images, the following problems occur: out_ds.GetRasterBand(i).WriteArray(x_nor) # Write each band’s data to memory UnboundLocalError: local variable ‘x_nor’ referenced before assignment Error code snippet: if data.min() <0: # Convert lagndsat8 data background value -19999 to 0 value data = np.where(data <0, 0, data) # assign the […]

[Solved] Error in paging query: The bean ‘localeResolver’, defined in class path resource [com/botany/spore/core/config/Comm

Problem Description: **************************** APPLICATION FAILED TO START **************************** Description: The bean ‘localeResolver’, defined in class path resource [com/botany/spore/core/config/CommonConfig.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/ boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class] and overriding is disabled. Action: Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true Solution: […]

[Solved] svn svn pull code error, Can’t convert string from ‘UTF-8’ to native encoding, modify server character set settings, locale view server language settings

Question: Execute the svn co svn path command to pull the code and report an error Can’t convert string from ‘UTF-8’ to native encoding: svn: E000022: Can’t convert string from ‘UTF-8’ to native encoding: svn: E000022: /home/htsc/HTSC-4.0/hydrator2.4.0/python-programed-plugins/src/main/resources/train/?\230?\183?\177?\229?\186?\166? \229?\173?\166?\228?\185?\160?\230?\143?\146?\228?\187?\182?\229?\188?\128?\229?\143 ?\145?\230?\150?\135?\230?\161?\163.docx Reason: SVN client requires utf8 to support Chinese Resolve: Modify the environment variable /etc/profile: export LC_ALL=en_US.UTF-8 […]

[Solved] Resolve react Module not found: Can’t resolve ‘./locale’ in after installing antd. . . The problem

React appears Can’t resolve ‘./locale’in after installing antd. . . The problem is that moment has problems with versions after 2.2, and react uses the latest moment by default, but there is no problem in [email protected]. Solution: Configure the alias of webpack, Import all moment path references to [email protected] Steps 1. Install moment depends on […]

[Solved] MongoDB exception: Query failed with error code 2 and error message ‘Field ‘locale’ is invalid – a very pitiful problem.

org.springframework.dao.DataIntegrityViolationException: Write operation error on server mongodb_host:27017. Write error: WriteError{code=2, message=’Field ‘locale’ is invalid in: { locale: “user\ ” }’, details={}}.; nested exception is com.mongodb.MongoWriteException: Write operation error on server mongodb_host:27017. Write error: WriteError{code=2, message=’Field ‘locale’ is invalid in: { locale: “user” }’, details={}}. at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:117) at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:3044) at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:600) at org.springframework.data.mongodb.core.MongoTemplate.doUpdate(MongoTemplate.java:1735) at org.springframework.data.mongodb.core.MongoTemplate.updateFirst(MongoTemplate.java:1653) at […]

[Solved] Failed to set locale, defaulting to C.UTF-8 solution

The CentOS 8Linux system prompts “Failed to set locale, defaulting to C.UTF-8”, which is caused by not configuring the correct locale. Linux Encyclopedia: Log in to your CentOS operating system with the root account and execute the following two commands: echo “export LC_ALL=en_US.UTF8” >> /etc/profile source /etc/profile Solve the problem The article knowledge points match […]

[Solved] wxPython calls CEF to embed the browser, Pyinstaller is packaged into an exe and an error is reported: Could not load locale pak for en-US

Package the project Pyinstaller -F -i Warning.ico app.py After running, open app.exe and report an error: [0812/112825.786:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received. Here are other solutions online: 1. Go to the github website of cefpython3 https://github.com/cztomczak/cefpython to download the source code, and copy the hook-cefpython3.py file in the /examples/pyinstaller directory of the project […]

[Solved] Pytorch – error resolution: “torch/optim/adamw.py” beta1, UnboundLocalError: local variable ‘beta1’

Error screenshot Solution The problem appeared in Pytorch 1.8.x version, and it can be solved by updating Pytorch to 1.9.0. Uninstall: pip uninstall torch Reinstall version 1.9.0: pip install torch==1.9.0 + cu111 torchvision==0.10.0 + cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html Installation tutorial reference: Ubuntu18.04–Private house finishing and installing NIVIDA driver (11.4), CUDA11.2, cudnn8.2, TensorRT8.0, Pytorch1.9.0