![]() ![]() ![]() To fix this error, check if: your string literal isn't. Escape sequences work in strings created with either single or double quotes. JavaScript makes no distinction between single-quoted strings and double-quoted strings. String literals must be enclosed by single ( ') or double ( ') quotes. ![]() Pro-Tip: Check if your SQL command is correct passing the command directly from your database on phpmyadmin and check if it trow errors. There is an unterminated string literal somewhere. If this doesn't resolve your problem try to use concatenation to pass the $query var, like this: exec("mysql -h$host -u$user -p$pass $dbname -e ".$query."") Īlso try to var_dump your $query like this: var_dump($query) īecause you may need to fetch your results before passing them to the exec command. I then set the two environment variables: export PUPPETEEREXECUTABLEPATH'chromium' export PUPPETEERSKIPCHROMIUMDOWNLOAD1 I tried running the program again, but got another error, this time because I was running as root. I'm on a debian machine, so it's not chromium-browser. "' FIELDS TERMINATED BY ',' ENCLOSED BY '".$enc."' LINES TERMINATED BY '\n' " I downloaded the chromium browser with apt install chromium. $query = "SELECT DISTINCT(emailid), COUNT(emailid), GROUP_CONCAT(DISTINCT offers) FROM '". So your final code would be: $outfile = '/home/dotslash/file.csv' As soon as you got rid of the parsing error, you have found the problem source. If you can't isolate the problem source, start to comment out (and thus temporarily remove) blocks of code. Syntax error: Unterminated quoted string WARNING: exit code 2 from a shell command. Partitioning up long code blocks really helps to locate the origin of syntax errors. i faced problem while im trying to install xampp on ubuntu mate 16.04 i follow this steps : 1 - chmod 755 n. There may be a problem in your SQL with the. r89/temp/run.doinstall.80432: Syntax error: Unterminated quoted string. That seems to apply here because TSTRING indicates a problem with a string literal. Common errors are a missing semicolon at the line end and unterminated string literals (missing the terminating single or double quote character or using the wrong one). "' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' " Įxec("mysql -h$host -u$user -p$pass $dbname -e '$query'") So inspect those or edit your question to show them. $con = mysql_connect($host, $user, $pass) So your code would look like: $outfile = '/home/dotslash/file.csv' Add this string after your database informations: $con = mysql_connect($host, $user, $pass) Īnd at the end of the script add: mysql_close($con) Note that the subprocess module is the recommended solution now.Are you connected to your database? In your script it doesn't seem to. Try something like this instead: cmd = # Need full path! Solution updated answer seems to have the correct diagnostic, but the correct fix is to not use a shell to invoke wc. You could add the following function to your program: def shellquote(s): I suspect what has changed is that a source file containing a ' in its name has been added to the directory you are checking and the shell is choking on this. Then you should be able to run the following, assuming your script is at /path/to/your_script.py and it has the executable bit set: /path/to/your_script.py arg1 arg2 Īlternatively: python /path/to/your_script.py arg1 arg2 Add the following to the top of your file: #!/usr/bin/env python Your Python script is missing a shebang line. Stack Exchange network consists of 181 Q
0 Comments
Leave a Reply. |