Category Archives: How to Fix

Error syntax error: invalid syntax in PIP install XXX

Python — PIP Install XXX reporting SyntaxError: invalid Syntax
After installing python and entering the python runtime environment, I executed PIP install aiohttp because I was going to use PIP to install the third-party library needed for developing Web App. I found SyntaxError: invalid syntax. At first I thought it was a spelling or space problem or a python version problem, but the result was the same with pip3.


Then Baidu checked and found that the original PIP installation had to be started in the CMD command line, but it could not run in Python. Exit the Python runtime and execute PIP again.

> > > exit()

C:\Users\jiangmengying01>
Downloading aiohtt-2.3.6-cp36-cp36mwin_amd64. WHL (370kB)
35% | | █ █ █ █ █ █ █ █ █ █ █ █ ▍ eta 0:00:0 | 143 KB, 956 KB/s
41% | █ █ █ █ █ █ █ █ █ █ █ █ █ ▎ | 153 KB eta 0:00 1.0 MB/s:
.

[spring] start error: nosuchmethoderror: javax.servlet.http . HttpServletResponse.getStatus () I

The Spring V4.1.0+ version will report the following error when running on an application server that does not support Servlet3.0:
NoSuchMethodError: javax.mail. Servlet. HTTP. HttpServletResponse. GetStatus () I
For example: tomcat 7 or less, JBoss 4.2.3 or less

There are two solution versions (you can choose either one) :
1) Back to Spring V4.0.7
2) Upgrade the application server to one that supports Servlet3.
Such as Tomcat7 + (preferably Tomcat8 +), JBoss as 7+
                 

SyntaxError: unexpected EOF while parsing

Error in the eval() function
Correct code snippet:

with open("COCO_train.json", "r+") as f:
    data = f.readline()
    data = data.strip('{').split('{')
    del data[0]
    del data[-1]
for i in data:
    i = '{' + i[: -2]
    i = eval(i)

Error code segment:

with open("COCO_train.json", "r+") as f:
    data = f.readline()
    data = data.strip('{').split('{')
    del data[0]
for i in data:
    i = '{' + i[: -2]
    i = eval(i)

The general reason for this error is that the format is not correct. This error occurs when the blogger converts the string into a dictionary, because the last string is missing the} character, so delete it.
 

undertake Matlab, Python and C++ programming, machine learning, computer vision theory and guidance, undergraduate and master can, salted fish trading, professional answer please go zhihu, detailed talk please contact QQ number 757160542, if you are the one.
 

ConnectionResetError: [Errno 104] Connection reset by peer

The fetch_MLdata function cannot download the MNIST dataset problem

from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')


solution
1. Download the data set

!wget https://github.com/amplab/datascience-sp14/raw/master/lab7/mldata/mnist-original.mat


2. View the SkLearn data root directory

from sklearn.datasets.base import get_data_home 
print (get_data_home())

!tree /root/scikit_learn_data


3. Copy the data set to mldata directory

!cp mnist-original.mat /root/scikit_learn_data/mldata
!tree /root/scikit_learn_data


4. Verify

from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')

mnist


5. OK!!!

mnist.data.shape

mnist.target.shape


added

from sklearn.datasets import fetch_openml	
mnist = fetch_openml('mnist_784', version=1)

can’t download it!

from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("./data/")

A case diagnosis and solution of DB2 error code 1639 and SQL state 08001 is described in detail

In the db2inst1/sqllib/security directory, check the permissions of the db2ckpw and db2chpw files.
 
A friend raised a problem with DB2 on Mars. After the initial installation and deployment, there was no problem with the local connection, but the remote could not connect to the database:

 
Error message: Error Code -1639, SQL State: 08001 :
There are several possibilities for this error, such as the firewall is not open for 50000 ports, but in this case, the client has closed the firewall and the port is accessible.
Another correlation issue is permissions, which are checked for db2ckpw and db2chpw files in the db2inst1/sqllib/security directory:

Change the major of these two files to root, change the permission to 4511, restart the database, the database can accept remote access:

Chown root db2chpw Chown root db2ckpw chmod 4511 db2chpw chmod 4511 db2ckpw


To summarize: the purpose of db2ckpw is to check the user id and password on the DB2 server. Because DB2 relies on operating system-level authentication, this process is used to verify the user id and password when a user or application connects to a database on the server. AUTHENTICATION is performed when AUTHENTICATION is set to SERVER, or when a connection is established from an insecure operating system. Verifying permissions requires checking the passwd file, and CKPW, as the name implies, means checking Password file, which is why the tool must be run as root and must be guaranteed if a remote connection is needed.
The following paragraph is clear:

db2ckpwd is the password checking daemon that deals with user authentication. This process is used to confirm that the id exists and has a right to be on the box. If the process if not a root process, only local connections will be allowed to the database because the id is already on the box. To make the OS API calls necessary to determine if the user has the right to be on the box, DB2’s db2ckpwd must run as root. If it is not started as root, it will not have Permissions to make the API calls, and it will return an SQL 30082 rc=24 error. Also since the db2ckpwd must su to root, in order to run as root, the db2ckpw file will need to have the su bit set, And the file system must be mounted so that su ‘ing is allowed.

DB2 creates the connection as follows:
Records are for reference.


Not enough after reading this article?The 2019 Data Technology Carnival is here! The charm of sharing data with you. Join now and enjoy the very low fares:
 

SELinux solution to Apache SSL failure

The blogger today plans to configure a multi-certificate Apache so that multiple domain names can be accessed via https://***. According to the online tutorial, just add multiple < VirtualHost *:443> You can do that. But restarting HTTPD always prompts:

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Journalctl-xe examines with the command:

systemd[1]: Unit httpd.service entered failed state.
systemd[1]: httpd.service failed.
polkitd[475]: Registered Authentication Agent for unix-process:7076:2357584 (system bus name :1.219 [/usr/bin/pkttyagent -.....

It’s hard to see what’s wrong (at this point the blogger doesn’t know that HTTPD has an error_log, face-covering)
After a long time, I finally opened /var/log/ HTTPD /error_log

AH02312: Fatal error initialising mod_ssl, exiting.
SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
Permission denied: AH02201: Init: Can't open server certificate file 

When the blogger saw this error message, he immediately understood that it was SELinux!! A lot of potholes on the SELinux before. So the first thing that comes to mind is that the SSL certificate file, the private key file, is not in the right context. Turning SELinux off directly would certainly solve the problem. But this is just a once-and-for-all approach that will cause more problems.
The solution
Three files are required to configure SSL:
2_domain.com.crt
3_domain.com.key
1_root_bundle.crt
Let’s say they’re all under /usr/local/apache/conf/

cd /usr/local/apache/conf/ 

Displays the current context of each file

ll -Z

Change context

chcon -u system_u -r object_r -t cert_t 1_root_bundle.crt
chcon -u system_u -r object_r -t cert_t 2_domain.com.crt
chcon -u system_u -r object_r -t cert_t 3_domain.com.key

The context configuration is not unique. If this setting doesn’t work, try something else.

Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) : invalid graphics state

I believe my dataframe is okay and my code is okay. In fact, I have eliminated parts of the dataframe and most of the graphing code to make things as basic as possible. But still, I get:

Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) : 
  invalid graphics state

What is wrong here?Here is the data:

 date   trt var val
1/8/2008    cc  sw5 0.2684138
1/8/2008    cc  sw15    0.2897586
1/8/2008    cc  sw5 0.2822414
2/8/2008    cc  sw5 0.2494583
2/8/2008    cc  sw5 0.2692917
2/8/2008    cc  sw15    0.2619167
2/8/2008    cc  sw5 0.204375
3/8/2008    cc  sw5 0.2430625
3/8/2008    cc  sw5 0.2654375
3/8/2008    cc  sw5 0.2509583
3/8/2008    cc  sw5 0.2055625
1/8/2008    ccw sw15    0.2212414
1/8/2008    ccw sw5 0.3613448
1/8/2008    ccw sw5 0.2607586
2/8/2008    ccw sw5 0.2087917
2/8/2008    ccw sw15    0.3390417
2/8/2008    ccw sw5 0.2436458
2/8/2008    ccw sw5 0.290875
3/8/2008    ccw sw5 0.20175
3/8/2008    ccw sw15    0.328875
3/8/2008    ccw sw5 0.2328958
3/8/2008    ccw sw5 0.2868958

When I work with this data, I specify dates like this:

df<-df[order(as.Date(df$date,format="%d/%m/%Y")),,drop=FALSE]

and here I want to make a scatterplot:

ggplot(data = df,aes(x = date,y = val)) + geom_point(aes(group = trt))


I ran into this same error and solved it by running:

dev.off()

and then running the plot again. I think the graphics device was messed up earlier somehow by exporting some graphics and it didn’t get reset. This worked for me and it’s simpler than reinstalling ggplot2.

\

The sharepoint2010 site cannot open a solution that displays an “an unexpected error has occurred” error

In client Onsite, SharePoint2010 site cannot be opened after automatic Windows patch installation is completed. The following error “An unexpected error has occurred” pops up.

After investigation, the following Security token error was found in the ULS Log “This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.”, it was believed that the FIPS related Security Settings were modified and enabled.

You can update it by following these steps:
1. Execute “Run” in the Start menu and enter gpedit.msc

2. In the “Local Group Policy Editor” that pops up, locate to Computer Configuration-> Windows Settings-> Security Settings-> Local Policies-> Security Options, find the Policy “System cryptography: Use FIPS Compliant Algorithms for Encryption, Hashing, and Signing” in the detailed Settings shown on the right.

3. Double-click the policy, double-click to open the Settings window, modify the option Disabled, and save

4. Refresh the website with problems before, the website can be opened normally, and the problem will be solved.
Thanks for reading.

Alibaba cloud ECS curl error 6

curl error 6
curl: (6) could not resolve host

According to the online statement, the DNS is modified to 8.8.8.8 and 8.8.4.4, which are still invalid
. After the start order
on aliyun, the DNS is changed to 100.100.2.138 and 100.100.2.136

Successfully resolved Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0xd3 in position 238: invalid continuation B

UnicodeDecodeError: ‘utF-8’ codec can’t decode byte 0xd3 in position 238: invalid Continuation B was successfully resolved
 
directory
To solve the problem
solution
The solution


 
 
 
To solve the problem
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd3 in position 238: invalid continuation byte
 
 
solution
Unicode decoding error: the “UTF-8” codec could not decode the byte 0xD3 in position 238: The continuing byte is invalid
 
 
The solution
Open the file in python’s IDE with a line of code at the top!
# -*- coding: utf-8 -*-
or
# coding: utf8