Category Archives: Python

Python: How to Solve error While importing windpy

First of all, I met this error report

>>> import WindPy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: source code string cannot contain null bytes

It’s probably the coding problem. The solution is to use vscode to open windpy.py (just search in the computer). There is a coding button in the lower right corner. Now the UTF-8 is displayed. Originally, it seems to be utf-16le. The Chinese displayed in the text is still garbled. Click this button and select save in this format.

And then there’s the following error report

SyntaxError: 'gbk' codec can't decode byte 0xbd in position 2985: illegal multibyte sequence

The solution is to delete all the comments.

It’s the last mistake.

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\**myfiles**\\Python\\Python38\\site-packages\\WindPy.pth'

The solution is to look for open in windpy.Py and comment all the following lines

Change the line that reads the library to the address of windpy.dll

    # pathfile=open(sitepath)
    # dllpath=pathfile.readlines();
    # pathfile.close();

    # sitepath=dllpath[0]+"\\WindPy.dll" 

    c_windlib=cdll.LoadLibrary('D:\\**install_WIND_files**\\x64\\WindPy.dll')

Just fine. I hope I can help you not to fall into the pit

[How to Solve] Python TypeError: ‘int‘ object is not subscriptable

The title is the teacher’s lesson, which is adapted from the python language design basis of Songtian teacher of Beijing Institute of technology, page 4.7, 121

Please modify example 5: body mass index BMI with exception handling, so that it can receive and process any input from the user

while True:
try:
Height, weight = Eval (input (“please input height (m) and weight (kg) [separated by commas]:”)
0         bmi = weight/pow(height,2)
Print (“BMI value is: {. 2F}”. Format (BMI))
0         if height > 3:
if h[:-1].isinstance():
Print (“height value is {. 2F}”. Format (height))
0                 break
elif weight > 150:
if   w[:-1].isinstance():
Print (“body weight value is {. 2F}”. Format (weight))
0                 break
except NameError:
Print (“input error, please input correct information”)
the     else:
Print (“no exception occurred”)
finally:
Print (“complete”)

The cause of the error is an operation on an object that cannot be operated on

The original errors were height [: – 1]. Isinstance and weight [: – 1]. Isinstance, which were changed to h and W

Please input height (m) and weight (kg) [comma separated]: 4,85
BMI value: 5.31
input error, please input correct information
complete
please input height (m) and weight (kg) [comma separated]: 1.85,85
BMI value: 24.84
no abnormality
complete
please input height (m) and weight (kg) [comma separated]: 1.85, 200
BMI value: 58.44
input error, please input correct information
complete
please input height (m) and weight (kg) [separated by commas]:

SyntaxError: Non-UTF-8 code starting with ‘\xe4‘ in file [How to Solve Chinese encoding problem]

Python 3 uses UTF-8 format by default

Generally, you don’t need to add a word at the beginning– coding:utf-8 —

However, in some Chinese, there will still be unrecognizable cases, and the error of “non-utf-8 code starting with” \ \ xe7 “will be thrown. At this time, you need to add this sentence in the first line.

#-*- coding:utf-8 -*-

Mybatis Plus update time error: Could not set property ‘updateTime’

background     

Encountered this problem for several hours, almost driven crazy. Record it.

Let me talk about the environment, MySQL database, the field name in the table is update_time, and the type is datetime. The corresponding variable in the Java entity class is updateTime of type java.util.Date.

After the environment account is completed, when I use the update statement to update the record, I keep getting an error saying that the type does not match. Post the error message:

  1 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'updateTime' of 'class com.sinosoft.secloud.admin.api.entity.CtgAppInfo' with value '2019-11-07T10:12:39.257' Cause: java.lang.IllegalArgumentException: argument type mismatch
  2     at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
  3     at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
  4     at com.sun.proxy.$Proxy187.update(Unknown Source)
  5     at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294)
  6     at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:69)
  7     at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:61)
  8     at com.sun.proxy.$Proxy195.updateById(Unknown Source)
  9     at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.updateById(ServiceImpl.java:208)
 10     at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl$$FastClassBySpringCGLIB$$76535273.invoke(<generated>)
 11     at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 12     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
 13     at com.sinosoft.secloud.admin.service.impl.AppInfoServiceImpl$$EnhancerBySpringCGLIB$$2ee21674.updateById(<generated>)
 14     at com.sinosoft.secloud.admin.controller.AppInfoController.update(AppInfoController.java:96)
 15     at com.sinosoft.secloud.admin.controller.AppInfoController$$FastClassBySpringCGLIB$$4d69b343.invoke(<generated>)
 16     at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 17     at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
 18     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
 19     at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
 20     at com.sinosoft.secloud.common.log.aspect.SysLogAspect.around(SysLogAspect.java:36)
 21     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 22     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 23     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 24     at java.lang.reflect.Method.invoke(Method.java:497)
 25     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
 26     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
 27     at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
 28     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
 29     at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
 30     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
 31     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
 32     at com.sinosoft.secloud.admin.controller.AppInfoController$$EnhancerBySpringCGLIB$$8e8549a.update(<generated>)
 33     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 34     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 35     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 36     at java.lang.reflect.Method.invoke(Method.java:497)
 37     at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
 38     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
 39     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
 40     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
 41     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
 42     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
 43     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
 44     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
 45     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
 46     at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:919)
 47     at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
 48     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
 49     at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
 50     at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
 51     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
 52     at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
 53     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 54     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 55     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 56     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
 57     at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
 58     at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
 59     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 60     at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
 61     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 62     at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
 63     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 64     at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
 65     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 66     at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
 67     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 68     at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
 69     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 70     at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
 71     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 72     at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
 73     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 74     at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74)
 75     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 76     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 77     at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
 78     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 79     at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
 80     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 81     at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
 82     at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
 83     at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
 84     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
 85     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
 86     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 87     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 88     at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
 89     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 90     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 91     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 92     at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
 93     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 94     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 95     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
 96     at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
 97     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 98     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
 99     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
100     at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:50)
101     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
102     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
103     at brave.servlet.TracingFilter.doFilter(TracingFilter.java:86)
104     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
105     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
106     at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
107     at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
108     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
109     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
110     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
111     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
112     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
113     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
114     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
115     at com.sinosoft.secloud.common.data.tenant.TenantContextHolderFilter.doFilter(TenantContextHolderFilter.java:41)
116     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
117     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
118     at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
119     at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
120     at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
121     at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
122     at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
123     at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
124     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
125     at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
126     at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
127     at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
128     at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
129     at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
130     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
131     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
132     at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
133     at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
134     at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
135     at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
136     at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
137     at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
138     at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
139     at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
140     at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
141     at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
142     at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
143     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
144     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
145     at java.lang.Thread.run(Thread.java:745)
146 Caused by: org.apache.ibatis.reflection.ReflectionException: Could not set property 'updateTime' of 'class com.sinosoft.secloud.admin.api.entity.CtgAppInfo' with value '2019-11-07T10:12:39.257' Cause: java.lang.IllegalArgumentException: argument type mismatch
147     at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:185)
148     at org.apache.ibatis.reflection.wrapper.BeanWrapper.set(BeanWrapper.java:59)
149     at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:140)
150     at com.baomidou.mybatisplus.core.handlers.MetaObjectHandler.setFieldValByName(MetaObjectHandler.java:72)
151     at com.sinosoft.secloud.common.data.mybatis.ModelMetaObjectHandler.updateFill(ModelMetaObjectHandler.java:54)
152     at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.populateKeys(MybatisDefaultParameterHandler.java:192)
153     at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.processBatch(MybatisDefaultParameterHandler.java:120)
154     at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.<init>(MybatisDefaultParameterHandler.java:51)
155     at com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver.createParameterHandler(MybatisXMLLanguageDriver.java:34)
156     at com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver.createParameterHandler(MybatisXMLLanguageDriver.java:28)
157     at org.apache.ibatis.session.Configuration.newParameterHandler(Configuration.java:550)
158     at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:69)
159     at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:41)
160     at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:46)
161     at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:563)
162     at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48)
163     at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
164     at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
165     at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
166     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
167     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
168     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
169     at java.lang.reflect.Method.invoke(Method.java:497)
170     at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
171     ... 142 common frames omitted
172 Caused by: java.lang.IllegalArgumentException: argument type mismatch
173     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
174     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
175     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
176     at java.lang.reflect.Method.invoke(Method.java:497)
177     at org.apache.ibatis.reflection.invoker.MethodInvoker.invoke(MethodInvoker.java:44)
178     at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:180)
179     ... 165 common frames omitted

After repeated checks, there is nothing wrong with the types in the database and the Java entity classes, and the cache is also cleaned up, and they are all invalid. This has always been wrong. Then the time is not updated directly in the logic layer, only other fields are updated, the result is useless, and this error is still reported! So I suspected that there might be a problem with the Mybaits Plus framework. My colleague said that the update time might be automatically added, but I didn’t find a description on the official website for a long time. In the end, I figured out a solution by myself. The solution is attached below:


 

method one:

Modify the field name to something else, such as update_date or update_times

Method Two:

Keep the field name unchanged, change the field type in Java to java.time.LocalDateTime, and assign a value to LocalDateTime.now().

 

[Solved] RuntimeError: cuda runtime error: device-side assert trigger

In this way, when running fastercnn, we need to change the original model’s 21 categories to our own number of categories. After the first modification, no error will be reported in the run, and after the second modification, an error will be reported as follows:
1 block: [0,0,0], thread: [16,0,0] assertion T & gt= 0 && amp; t < n_ Classes failed.
2 runtime error: CUDA runtime error (59): device side assert triggered
the main solutions on the Internet are as follows:

The reason for this problem is that there are tags in the training data that exceed the number of categories. For example, I set up a total of 8 classes, but if 9 appears in the tag in the training data, this error will be reported. So here’s the problem. There’s a trap. If the tag in the training data contains 0, the above error will also be reported. This is very weird. Generally, we start counting from 0, but in Python, the category labels below 0 have to report an error. So if the category label starts from 0, add 1 to all category labels.

Solution:
The first time I ran the program, I found that there were 16 categories (I deleted 4 categories, but I didn’t find them). After running the program, I found that there were four more categories, so I deleted these four categories. However, when I ran the program again, I reported the above error. The reason is that every time we
run the program, we have to delete the cache generated by the last run, because I didn’t delete it, so the program thought it was 16 categories, But only 12 categories are provided. So if you report this error, you can delete the cache and run it again

How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’

AttributeError: ' dict ' object has no attribute ' item '

This error means that python cannot find the attributes of the corresponding object, and the beginners don’t know enough about the function object, which leads to errors

Original code:

favorite_languages ​​= {
     ' jen ' : ' python ' ,
     ' sarah ' : ' c ' ,
     ' edward ' : ' ruby ' ,
     ' phil ' : ' python ' ,
    }
for name,language in favorite_languages.item():
     print (name.title()+ " 's favorite language is " +language.title()+ " . " )

The text editors we use generally use obvious colors as hints:

 

 Modified code:

favorite_languages ​​= {
     ' jen ' : ' python ' ,
     ' sarah ' : ' c ' ,
     ' edward ' : ' ruby ' ,
     ' phil ' : ' python ' ,
    }
for name,language in favorite_languages.items():
     print (name.title()+ " 's favorite language is " +language.title()+ " . " )

operation result:

1 Jen ' s favorite language is Python. 
2 Sarah ' s favorite language is C. 
3 Edward ' s favorite language is Ruby. 
4 Phil ' s favorite language is Python. 
5 Sarah ' s favorite language is C.

 Summarize the commonly used Python error types as follows:

  • ZeroDivisionError-divide (or modulo) zero (all data types) 
  • ValueError-Invalid parameter passed in 
  • AssertionError-assertion statement failed 
  • StopIteration-the iterator has no more values 
  • IndexError-there is no such index in the sequence (index) 
  • IndentationError-indentation error 
  • OSError-input/output operation failed 
  • ImportError——Failed to import module/object 
  • NameError-Object not declared/initialized (no attributes) 
  • AttributeError- indicating that the object does not have this attribute
  • GeneratorExit-an exception occurs in the generator to notify the exit 
  • TypeError-invalid operation on the type 
  • KeyboardInterrupt-user interrupt execution (usually input ^C) 
  • OverflowError-Numerical operation exceeds the maximum limit 
  • FloatingPointError-floating point calculation error 
  • BaseException-the base class of all exceptions 
  • SystemExit-interpreter requests to exit 
  • Exception-the base class for general errors 
  • StandardError-the base class for all built-in standard exceptions 
  • ArithmeticError-the base class for all numerical calculation errors 
  • EOFError-there is no built-in input, reaching the EOF mark 
  • EnvironmentError-the base class for operating system errors 
  • WindowsError-system call failed 
  • LookupError-the base class for invalid data query 
  • KeyError-there is no such key in the map 
  • MemoryError-memory overflow error (not fatal to the Python interpreter) 
  • UnboundLocalError-access to uninitialized local variables 
  • ReferenceError-Weak reference attempts to access objects that have been garbage collected 
  • RuntimeError-general runtime error 
  • NotImplementedError-method not yet implemented 
  • SyntaxError Python-syntax error 
  • TabError-Tab and space are mixed 
  • SystemError-general interpreter system error 
  • UnicodeError-Unicode related errors 
  • UnicodeDecodeError-Unicode decoding error 
  • UnicodeEncodeError-Unicode encoding error 
  • UnicodeTranslateError-Unicode conversion error

The following are warning types 

  • Warning-the base class of warnings 
  • DeprecationWarning-warning about deprecated features 
  • FutureWarning-a warning that the semantics of the structure will change in the future 
  • OverflowWarning-old warning about automatic promotion to long integer (long) 
  • PendingDeprecationWarning-warning about the feature will be deprecated 
  • RuntimeWarning-warning of suspicious runtime behavior 
  • SyntaxWarning-warning of suspicious syntax 
  • UserWarning-warning generated by user code

Solution for Python3.7 import gevent module error

Recently updated python interpreter 3.7

As a result, gevent was installed, and an error was reported after gevent was imported. The error message is as follows

RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144, got 128
  return f(*args, **kwds)

Seeing that there are not many posts about this issue, I posted it first.

Just execute the following piece of code.

pip3 install -U --force-reinstall --no-binary :all: gevent

Attach parameter description

-U, --upgrade
Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.
--force-reinstall
Reinstall all packages even if they are already up-to-date.
--no-binary <format_control>
Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package names with commas between them. Note that some packages are tricky to compile and may fail to install when this option is used on them.

The general meaning of this command is to use a non-binary package to reinstall gevent and its dependencies.

In short, the problem was solved perfectly after executing this command.

The currently installed gevent version and greenlet version are 1.3.5 and 0.4.14 respectively

Pandas Read csv Error tokenizing data. C error: Expected 18 fields in line 173315, saw 20

 Error tokenizing data. C error: Expected 18 fields in line 173315, saw 20

The content of this line is

b55421db8f2f7f9610e7dfc08bcc76e5	Sales consultant listed company with high salary and high commission - 719 \N 1 10000 5000 20190314 20190413 0 -1 null College \N \N Job duties: 1. independent and high quality to complete the reception of visiting customers, to introduce courses and related services, and lead to registration; 2. patient, detailed answers to customer questions of the consultation 3.Explore the potential needs of customers and make accurate recommendations for the courses; 4.Work with the team to complete sales tasks according to the sales target set by the company; 5.Work with other departments to complete the work. Requirements: 1. Good customer service consciousness, good self-motivation; 2. Strong learning ability, active and positive, team spirit; 3. Quick thinking, fast reaction, standard Mandarin; 4. Sales experience is preferred. Benefits: 1. perfect social insurance (five insurance and one gold); 3. position promotion���� clear: course consultant - reserve principal - principal - regional director; 4. training: professional vocational skills training + personalized career promotion guidance; 5. open office environment of the Internet company. ☆ This is a team belonging to young people, this is the platform for you to play, this is your wonderful! Looking forward to growing with you!

Pandas can’t parse
although this line of data can be changed to the correct form after processing, there are 4000 + lines of data with different problems.

Using error_ bad_ Lines = false to solve the problem and ignore the disordered lines

[Solved] Python AssertionError: MMCV==1.1.0 is used but incompatible. Please install mmcv>=1.0.5, <=1.0.5.

Traceback (most recent call last):
  File "tools/test.py", line 12, in <module>
    from mmdet.apis import multi_gpu_test, single_gpu_test
  File "d:\a\a project\cv\mmdetection-master\mmdet\__init__.py", line 25, in <module>
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
AssertionError: MMCV==1.1.0 is used but incompatible. Please install mmcv>=1.0.5, <=1.0.5.
mmcv

The version needs to be 1.0.5, and the default installation is 1.1.0.

Unload mmcv first

pip uninstall mmcv
pip uninstall mmcv-full

Then install the version of mmcv as 1.0.5

pip install mmcv==1.0.5

How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow

preface
There are various problems encountered during the use of TensorFlow. It is helpful to write them down for review and future learning
Problem description
When TensorFlow is installed in Anaconda, the following problem is encountered:

>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Anaconda\envs\dl\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "D:\Anaconda\envs\dl\lib\site-packages\tensorflow\python\__init__.py", line 59, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "D:\Anaconda\envs\dl\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "D:\Anaconda\envs\dl\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified program could not be found.

The solution
Protobuf was upgraded yesterday when Object-Detection was installed, so if you call back the version of Protobuf, you should be fine.

pip install protobuf==3.6.0

Python reads excel and stores it in the list according to the header hash copy.deepcopy



def getInfoOfInputFile(input_file_path):

    global info
    info = []
    temp = {}
    getInfo = pd.read_excel(os.path.join(os.getcwd()+'\\input', input_file_path), sheet_name="frequency_plan", dtype=str, keep_default_na=False)

    columns = getInfo.columns.size  
    rows = getInfo.iloc[:, 0].size  

    for i in range(0, rows):
        temp['MAINFLOW'] = getInfo['MAINFLOW'][i]
        temp['SUBFLOW'] = getInfo['SUBFLOW'][i]
        temp['TESTSTUITE'] = getInfo['TESTSTUITE'][i]
        temp['SPEC'] = getInfo['SPEC'][i]
        temp['TESTMOTHED'] = getInfo['TESTMOTHED'][i]
        temp['PARA'] = ''
        for j in range(5, columns):  # parameters start from column 6
            if(getInfo.iat[i, j] == ''):
                pass
            else:
                temp['PARA'] += ((getInfo.iat[i, j])+'\n\t\t\000')
        print(temp['PARA'])
        print("*******************************")
        info.append(copy.deepcopy(temp))
    # return info