_mysql.c:602:error:expected expression before) token solution

Source: Internet
Author: User

This problem is encountered when installing Mysql-python:

[root@centos01 mysql-python-1.2.4b4]# python setup.py build
Running Build
Running Build_py
Copying mysqldb/release.py-> Build/lib.linux-i686-2.4/mysqldb
Running Build_ext
Building ' _mysql ' extension
Gcc-pthread-fno-strict-aliasing-dndebug-o2-g-pipe-wall-wp,-d_fortify_source=2-fexceptions-fstack-protector--pa Ram=ssp-buffer-siz E=4-m32-march=i386-mtune=generic-fasynchronous-unwind-tables-                                      d_gnu_source-fpic-fpic-dversion_info= (1,2,4, ' beta ', 4)-d__version__=1. 2.4b4-i/usr/local/mysql/include/mysql-i/usr/include/python2.4-c _mysql.c-o Build/temp.linux-i686-2.4/_mysql.o-g- Duniv_linux
_mysql.c:in function ' _mysql_connectionobject_initialize ':
_mysql.c:602:error:expected expression before ') ' token
Error:command ' gcc ' failed with exit status 1


There is a problem with the source code here, find _MYSQL.C 602 lines near, find the following code:

if (! Pyarg_parsetupleandkeywords (args, Kwargs,
#ifdef Have_mysql_opt_read_timeout
"|ssssisoiiisssioii:connect",
#else
"|ssssisoiiisssioi:connect",
#endif
Kwlist,
&host, &user, &passwd, &db,
&port, &unix_socket, &conv,
&connect_timeout,
&compress, &named_pipe,
&init_command, &read_default_file,
&read_default_group,
&client_flag, &ssl,
&local_infile,
#ifdef Have_mysql_opt_read_timeout
&read_timeout
#endif
))


return-1;

To

if (! Pyarg_parsetupleandkeywords (args, Kwargs,
#ifdef Have_mysql_opt_read_timeout
"|ssssisoiiisssioii:connect",
#else
"|ssssisoiiisssioi:connect",
#endif
Kwlist,
&host, &user, &passwd, &db,
&port, &unix_socket, &conv,
&connect_timeout,
&compress, &named_pipe,
&init_command, &read_default_file,
&read_default_group,
&client_flag, &ssl,
&local_infile
#ifdef Have_mysql_opt_read_timeout
, &read_timeout
#endif
))


return-1;

And then rerun the Python setup.py build, OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.