Category Archives: How to Fix

Python error: pandas.errors.ParserError: Error tokenizing data. C error: Expected 3……

Error message
When doing data processing in Python, the following error is reported:

pandas.errors.ParserError: Error tokenizing data. C error: Expected 3 fields in line 28, saw 4


The reason for the error
First, let’s take a look at error reporting:

pandas.errors.ParserError: Error tokenizing data. C error: Expected 3 fields in line 28, saw 4

Translation:

Alphaers. errors.parserror: Error marking data. C Error: Three fields are required on line 28, see 4

The error was caused by a data set format error.
The solution
We need to modify the data format or make some Settings in the read-in. The following two methods are feasible:
1. Modify the read-in code
Add the following parameters after reading the code:

error_bad_lines=False #Addition of parameters

2. Modify the file format
I made the error because I was lazy and modified the suffix name directly. The correct way to do this is to open the file in the format required by another existing dataset. For example, I need a CSV file, and the existing file is XLSX. I need to open another CSV file, and the suffix name cannot be directly modified.

WindowsError: [Error 2] The system cannot find the file specified

I did a performance error opening Firefox with Selenium in ipython Notebooks, using the Firefox browser with the following code:

from selenium import webdriver
driver = webdriver.Firefox()

The error message is as follows:

The error the code returns is as follows:
    WindowsError                              Traceback (most recent call last)
<ipython-input-7-fd567e24185f> in <module>()
----> 1 driver = webdriver.Firefox()

Solutions:
When you try to initialize Firefox(), specify the Firefox binaries. The default path, FirefoxDriver, is in %PROGRAMFILES%\Mozilla Firefox\ Foxfox.exe. Specify the Firefox Driver or add the path of the Firefox binaries to the Windows path. The code to specify the firefoxdriver path is as follows:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('path/to/binary')
driver = webdriver.Firefox(firefox_binary=binary)

Sweep yards attention
Practical AI Inn
Get the latest AI information and practical cases

WeChat ID: langu86

Git commit encountered error: pathspec (Fixed)

 This is the first problem I've encountered as a rookie just learning to use git.
 The problem is that after git clone a repository, it adds two files to it, but when git commits, it says error: pathspec 'add README.txt.........' did not match any file(s) known to git.
 When I looked at the command more closely, I found that I was missing the -m parameter in my git commit, and the error was: git commit 'add README.txt'.
 The error is: git commit 'add README.txt_.....'
 It should read: git commit -m 'add README.txt......'

Microsoft JScript runtime error: ‘sys’ is undefined

Microsoft JScript Runtime Error: ‘Sys’ is undefined solution

Want to learn AJAX system, unexpectedly just drag a ScriptMange, appeared “Microsoft JScript runtime error: ‘Sys’ is undefined” error, Google a, found that the original friends have also encountered a similar error, put the method post,

ajax.net1.0 official version
in web.config–> Add
< httpHandlers> < remove verb=”*” path=”*.asmx”/>
& lt; add verb=”*” path=”*.asmx” validate=”false” type=”System.Web.Script.Services.ScriptHandlerFactory”/>
& lt; Add the verb = “the GET and HEAD” path = “ScriptResource. Axd” type = “System. Web. Handlers. ScriptResourceHandler, System. Web. Extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken=31bf3856ad364e35” validate=”false”/>
& lt; /httpHandlers>

From:
http://www.cnblogs.com/zhonghua-sun/archive/2008/04/14/1152555.html

Windows 10 upgrade 1803 failed because of dual hard disk!!

Microsoft in recent days to push the win10 1803 version of the update, and then when I upgrade has been wrong, tip need to restart the complete installation, but after the restart and prompt 0 x80070002 error, tried 4, 5 times the same mistake repeatedly, baidu, said with win10 rise would have the chances of success, hope to try, can be the result of nima is the prompt me,
What The FK!! Update is going to give up, close the 35 days to update, obsessive compulsive disorder, I do not lose heart, however, continue to baidu, see some old article mentioned Windows 7 upgrade win10 similar mistakes, the reason is caused by double hard disk, and my machine is a mechanical hard disk and a solid, estimates that, immediately began unstitching chassis, pull the mechanical drive, the power cord cable boot, to update, brush brush… Problem solved!! Problem solved!! Problem solved!! Ten thousand monsters in my heart! Is this Microsoft update too sloppy??BUG10 lives up to its name?

Solution of 500 internal server error reported by [SVN] TortoiseSVN

Background: For some reason, I restarted the physical machine of SVN service. After restarting, I found that everyone accessing SVN reported the following error.

Since no changes have been made before the restart, I am a little confused about this error. I have tried firewall, network management, cache cleaning and other methods, but still haven’t solved the problem. There is no problem between the network, can ping and Telnet each other, but the access report 500 errors.
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — omitted here for a long time of research time…
Solutions:
1. Log in to SVN Server and open VisualSVN Server management tool.
2. Right-click to open the property “Properties”, as shown in the figure below:

3. See the “Automatically adjust Permissions “option on the General screen. If the value has been checked, undo the check and apply it. During the process, it will re-serve.

 
After the above steps, I visited SVN again and found that the problem was solved. After such a long study, the rain finally cleared up. This should be a SVN permission failure, I hope this method can help you open the article.

Reproduced in: https://www.cnblogs.com/whylaughing/p/7646419.html

error C2146: syntax error : missing ‘;’ before identifier ‘fd’

Compiler error: error C2146: Syntax error: Missing ‘; ‘ before identifier ‘fd’
Follow up my_socket FD in mySQL_com.h file; /* For Perl DBI/ DBD */ line, found that the compiler does not recognize my_socket, but my_socket is defined in mysql.h: #define my_socket SOCKET, so the next is the SOCKET definition. SOCKET definition is in Winsock2.h, but with the predefined # IFDEF ___, the header winsock2.h is not included at all.
Solution: In #include< mysql.h> With # include< winsock2.h> Can!

Error: 701 use DAC connection when out of memory

Some time ago, when I tested the MEMORY database of SQL Server 2014, I found that if the size of the database exceeded the set maximum memory, Error: 701 occurred in SQL Server.
 
Error message:
 
Error: 701, Severity: 17, State: 123.
There is insufficient system memory in resource pool ‘internal’ to runthis query.
 
At that time, I deleted the database and restarted it. In fact, I could still connect it with DAC when I was out of memory.
 
Here’s what I did:
Default connection failure:

The DAC connection is successful (you can also use SQLCMD DAC):

 
Since the server still had memory resources at that time, It was ok to directly modify the maximum memory:
 
sp_configure ‘show advanced options’, 1;
GO
RECONFIGURE;
GO
sp_configure ‘max server memory’, 4096;
GO
RECONFIGURE;
GO
 
If connected to THE DAC, you can check the status of the system, and the session found some problems can be processed, so there is no need to restart the SQL Server, and problems can be found in a timely manner.
 
 
 

Error: 7884, Severity: 20, State: 1

Background:

The program interrupted “TCPProvider, error: 0-an existing Connection was removed by the remotehost.” There was no problem with manually executing the query, but the execution time was tens of seconds. The execution of the Trace program was found to take tens of minutes, due to the fact that the SqlDataReader was used to read the data and a series of data processing was carried out during the reading process, which made the complete process take a long time. Therefore, it is suspected that some factors such as network instability caused the connection break in the processing process. After coordination, the data was changed to DataTable for one-time data loading. After program adjustment, the frequency of failures was greatly reduced, but it cannot be completely eliminated.

Upon further inspection, the following errors were found in the SQLServer log:

Error: 7884, Severity: 20, State: 1. (Params:). The Error is printed in terse mode because there waserror during formatting. Tracing, ETW, notifications etc are skipped.

This error differs from the standard description in sys.messages and a web search did not find a suitable solution.

Screen:

I directed the table of the query to a server for testing, and finally found that it was related to an NVARCHar (Max) column. Then I remembered that some time ago, I changed the data column of the problem from NTEXT to NVarchar (Max) because of a problem with Logreader, so I specifically tested this change and finally determined that the problem was caused by this change.

(The text/ntext column may cause problems with the logreaderagent, which has been encountered many times, but there is no clear way to reproduce the failure, so we will not discuss this.)

Failure recurrence:

Use the following T-SQL to create the test table, data, and modify the Ntext column NVARCHAR (Max)

– = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

— Create test tables

– = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

USE tempdb;

GO

IF OBJECT_ID(N’dbo.tb_test’, ‘U’) IS NOT NULL

DROPTABLE dbo. Tb_test;

GO

CREATE TABLEdbo.tb_test(

Id intIDENTITY PRIMARYKEY,

Code varchar (50),

Datedatetime,

The Value ntext

);

GO

INSERT dbo.tb_test

SELECT TOP(10000)

Code =RIGHT(10000000000 +ABS(CHECKSUM(NEWID())) % (1000 * 2), 20),

Date= DATEADD(DAY, CHECKSUM(NEWID()) % 100, GETDATE()),

Value = the CONVERT (char (36), NEWID ())

FROM sys.all_columns A WITH(NOLOCK)

, sys. All_columns WITH B (NOLOCK)

;

GO

 

– = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

— Change the ntext field type to NVARCHAR (Max)

– = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

ALTER TABLEdbo.tb_test ALTERCOLUMN Value nvarchar(max);

GO

 

Write the program, query the data, and change the data before the query is completed, which is tested with the PowherShell

# connection string

$ConnectionString = “Data Source = 127.0.0.1; InitialCatalog=tempdb; Integrated Security=SSPI”

 

# Open connection

$SqlCnnectionQuery = New-Object System.Data.SqlClient.SqlConnection -ArgumentList $ConnectionString

$SqlCnnectionQuery.Open()

 

# Query data

$SqlCommandQuery = New-Object System.Data.SQLClient.SQLCommand

$SqlCommandQuery.Connection = $SqlCnnectionQuery

$SqlCommandQuery.CommandText = “SELECT * FROM( SELECT value, row_id = ROW_NUMBER()OVER( PARTITION BY Code ORDER BY date DESC) FROM dbo.tb_test WITH(NOLOCK) )DATAWHERE row_id = 1”

$SqlReader = $SqlCommandQuery.ExecuteReader()

 

# Modify data

$SqlCnnectionUpdate = New-Object System.Data.SqlClient.SqlConnection -ArgumentList $ConnectionString

$SqlCnnectionUpdate.Open()

$SqlCommandUpdate = New-Object System.Data.SQLClient.SQLCommand

$SqlCommandUpdate.Connection = $SqlCnnectionUpdate

$SqlCommandUpdate.CommandText = “UPDATE top(1000) dbo.tb_test SET Value =CONVERT(char(36), NEWID() ) WHERE id IN( SELECT TOP 1000 id FROM dbo.tb_testORDER BY id DESC )”

$UpdateRows = $SqlCommandUpdate.ExecuteNonQuery()

$SqlCnnectionUpdate.Close()

“Update $UpdateRows rows.”

 

# Read query data

An error occurred during the reading process

# (SQL 2008 R2 SP2) : TCP Provider, error: 0-anexisting Connection was removed by the remote host.

# (SQL 2008 R2 SP3) : TCP Provider, Error: 0 – The SpecifiedNetwork Name is no longer available.

At line:1 char:22

“Read query data….”

$ReadRows=0

While($SqlReader.Read()) {$ReadRows+=1}

“Read $ReadRows rows.”

 

# Close connection

$SqlReader.Close()

$SqlCnnectionQuery.Close()

 

Fault handling:

For columns with modified data types, the problem can be solved by reupdating the data (UPDATE table SET modified columns = modified columns)

This problem has been tested from SQL Server2008 to 2014, there are problems. In the test of SQL Server 2008 R2 SP3, error information in THE SQL Server log is different, as follows:

Error: 7886, Severity: 20, State: 2.

A read operation on a large object failedwhile sending data to the client. A common cause for this is if the applicationis running in READ UNCOMMITTED isolation level. This connection will beterminated.

Perfectly solve the 1366 error of saving Chinese in MySQL

Most recently when using SQLAlchemy to store Chinese in a table in a mysql database:
Warning Code: 1366 penstring value: ‘\xE5\x9C\xA8’ for column ‘content’ at row 1
This is because we store Chinese, and our table does not support Chinese character set. We use show variables like ‘character%’. View mysql’s current encoding:

It can be seen that the character set of database and Server USES latin1, and latin1 does not support Chinese, which leads to the error of storing Chinese.
I tried two ways to avoid the Chinese storage error problem:
1: Set server and Database to UTF8 type
Use the following command to set input on the command line:
Show variables like ‘% char %’;
set character_set_server = utf8;
set character_set_database = utf8;
Use the command above. If not, show Create table. To see if the specific column has the wrong character set.
2: Set the default character set when building the table
When I build tables, I usually set the default character set to UTF8 in the SQL statement to avoid some problems:

sql='''create table analysis(city varchar(20),companySize varchar(20),education varchar(20))default charset=utf8'''

The default Charset = UTf8 is added at the end of the statement to set the default charset= UTf8, or at the end of the SQL statement if additional parameters need to be set.
 
★★★★★ ★★ warm tips:
This is a people encounter a problem, here said once: when using SQL statements, some of the words, letters is a class of special characters similar to python, import, etc., so if you want to use the key words, need to add the quotes ` to it, such as ` index `, the index is the key word, if used directly, will be an error. Therefore, I need to pay special attention to the fact that I always make mistakes when using it. I just can’t find the problem and think of other mistakes. Fortunately, I suddenly remember this problem mentioned by the database teacher accidentally.
 

To solve the problem that fastcgi process often fails recently, an unknown fastcgi error occurs

The questions are as follows:

Solutions:
Application pool -& GT; Advanced Setting -& GT; Identity: Change the default ApplicationPoolIdentify to LocalSystem.
Reference: https://github.com/Microsoft/PTVS/issues/2024

 

Quirky error 18: transfer closed with outstanding read data rem

Background: The laravel framework used by the company’s new project has no special operation and maintenance at the beginning. It USES guzzle encapsulated get/ POST external request method. When requesting an interface, if the number of pages per page per_page exceeds a certain number, an error will be reported
GuzzleHttp\Exception\RequestException: cURL error 18: transfer closed with outstanding read data remaining (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
A direct request from Postman sent back data, but it didn’t automatically beautify the format, and a request from curl sent back data plus an error message.
 
Solutions:
(Only for the solution of the problem encountered this time, the same error may be caused by different reasons)
Both server Nginx and FPM are run by WWW users. Set Nginx users as WWW and unify the permission configuration of LNMP system:

chown -R www.www /var/lib/nginx/

 
Solution process:
Error message prompt
http://curl.haxx.se/libcurl/c/libcurl-errors.html

CURLE_PARTIAL_FILE (18)
A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't match the previously given size.

The data transmitted is not consistent with the expected data size.
At first, we used postman to ask for an error in the package method in our project, and there was data sent back. Therefore, we thought there was something wrong with the guzzle method and sent the wrong request header. We spent a lot of time testing the keep-alive, content-Length, Transfer-Encoding: Chunked and other attributes of HTTP header HTTP1.1, but it didn’t work.
Careful use of the curl command to request the interface also found the error message, so I focused on the configuration of the server side. First, I estimated that the maximum amount of data transferred by Nginx or FPM was too small, but the maximum amount of data returned was not more than 100K, which should not exceed the configuration size.
Then search “PHP Nginx HTTP interface returns the maximum content” on Baidu.
https://blog.csdn.net/sakurallj/article/details/51822828
http://www.dewen.net.cn/q/1913
Return if PHP content is too big, nginx will put part of first deposit into a text file/var/lib/nginx/TMP/fastcgi, after receiving all content, such as to be sent to the client. However, nginx execution users do not have write permissions for TMP files under Nginx.
Then I checked nginx’s error_log and found that there was an error message. Later, the user role of LNMP was unified and the problem was solved…

2018/12/13 18:41:31 [crit] 30392#0: *380874 open() "/var/lib/nginx/tmp/fastcgi/3/43/0000000433" failed (13: Permission denied) while reading upstream, client: 182.18.28.66, server: , request: "GET /v1/user/list?page=1&perpage=50 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "123.123.123.13:11008”

Feeling, the user mechanism of Linux is not enough to understand deeply, the HTTP protocol a little understanding,,, encounter weird problems, the first step should always be to check the log!