syntax-error

SyntaxError: unexpected character after line continuation character

戏子无情 提交于 2019-12-02 09:27:08
问题 I am testing a code with doctest and I want to comment in front of the tests like this: Tests: >>> part([('Eva', 'Sao Paulo', 21098, '04-12', 1182),\ #False, 1, 0 ('Ana', 'Toquio', 21098, '06-12', 1182),\ ('Ana', 'Sao Paulo', 21098, '04-12', 1096)]) [2, 1] The problem is that when I run the code in the shell it gives me a synthax error: File "/home/user/Desktop/file.py", line 44, in __main__.part Failed example: part([('Eva', 'Sao Paulo', 21098, '04-12', 1182),\ #False, 1, 0 Exception raised:

Python: Return possibly not returning value

感情迁移 提交于 2019-12-02 09:21:00
Hello Stack Overflow Community, I am trying to write a program that checks Fermat's Last Theorem. The issue I am running into is that an error appears saying "NameError: name 'a' is not defined. However, I define 'a' in my first function and return its value at the end of the function. I am trying to use the inputed values from the first function in the second function so the user can define the parameters. Am I misunderstanding how to leverage "Return"? All help is greatly appreciate and will keep me sane. def input_fermat(): a=input('Enter the first variable \'a\': \n') b=input('Enter the

Unknown error relating to syntax of tokens

风格不统一 提交于 2019-12-02 09:19:30
问题 I can't work out what is wrong with the following code in Java: import java.util.*; public class stringCalculator { String operator_array[] = {"+", "-", "/", "*", "(", ")"}; Queue<Integer> outputQueue = new LinkedList<Integer>(); Stack <Object> operatorStack = new Stack<Object>(); Hashtable<String, String> operatorPrecedence = new Hashtable<String, String>(); operatorPrecedence.put("+", "2"); I am getting the following error: Syntax error on tokens, delete these tokens, This is in relation to

Cakephp generating xml error - blank space

淺唱寂寞╮ 提交于 2019-12-02 09:04:43
问题 I am trying to generate a dynamic xml document in CakePHP to output to the browser. Here is my controller code: Configure::write ('debug', 0); $this->layout = null; header('Content-type: text/xml'); echo "<?xml version=\"1.0\"?>"; View is something like this: <abc> something </abc> The output is probably as expected: <?xml version="1.0"?><abc>something</abc> The only problem is that there is a space before <?xml giving me an error: XML Parsing Error: XML or text declaration not at start of

Getting a Parse error: syntax error, unexpected '}', expecting ',' or '; [closed]

对着背影说爱祢 提交于 2019-12-02 08:38:44
Here is my code. I'm new to php and just trying to edit a page using Kompozer. When I published the site back to the ftp server this error suddenly appeared on the page. Odd since I didn't even touch this code. (I have since touched the below code trying to fix it). Any help fixing this code would be much appreciated. <?php if(isset($_SESSION["pkg_error"])) ?> <div class="error_msg_cont"> <?php foreach($_SESSION["pkg_error"] as $error) { echo $error. "<br>" } ?></div> <?php if(isset($_SESSION["msg"])) { echo '<div class="error_msg_cont">'. $_SESSION["msg"] .'<div>' } ?> cdhowie On these two

Syntax error while appending string separated by commas in mysql

匆匆过客 提交于 2019-12-02 08:23:33
I have following query SELECT diamondsList.*, dealers.* FROM diamondsList JOIN dealers ON diamondsList.dealerId = dealers.id WHERE price >= :minPrice AND price <= :maxPrice AND carat >= :minCarat AND carat <= :maxCarat AND clarity IN (SI2,VS1,SI1,VS2,VVS2,VVS1,IF,FL) AND color IN (J,H,D,E,F,G,I) AND diamondsType IN (BR,HS,CUS,RAD,AS,PRIN,OV,PS,MQ,EM) But I AM getting error {"error":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FL) AND color IN (J,H,D

Getting: SyntaxError: missing ) after argument list but can't find out whats wrong with hulpfile.js

别来无恙 提交于 2019-12-02 08:14:49
Hi I'm getting an error starting 'gulp default' with the following gulp file. I cannot figure out whats wrong with the file. var gulp = require('gulp'); var sass = require('gulp-sass'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('gulp-autoprefixer'); var browserSync = require('browser-sync').create(); var input = './scss/**/*.scss'; var output = './css'; gulp.task('sass', function() { return gulp.src(input) .pipe(sourcemaps.init()) .pipe(sass(errLogToConsole: true, outputStyle: 'compressed')) .pipe(autoprefixer(browsers: ['last 2 versions', '> 5%', 'Firefox ESR']))

Keep getting error “Can't locate Image/Grab.pm in @INC” after installing the Perl mod

↘锁芯ラ 提交于 2019-12-02 07:45:13
问题 I'm a bit new to programming and I'm having some trouble writing a Perl script that will grab all the images from a webpage and save them in a specified directory. Here's my code: use warnings; use strict; use lib '/home/User1/strawberry/cpan/build'; use Image::Grab; $pic = Image::Grab->new(SEARCH_URL=>'http://www.examplesite.com', REGEXP =>'.*\.gif|.*\.jpg'); my $dir = 'images'; opendir (IMG, ">>$dir") || die "Directory doesn't exist - $!\n"; foreach ($pic) { print IMG "$_\n"; } closedir IMG

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE

久未见 提交于 2019-12-02 07:43:53
问题 I might have a syntax error or something but I don't see nothing. <select id="cd" name="cd"> <?php while($row=mysql_fetch_array($cdresult)) { echo "('<option value='$row['Poblacion']'></option >'.'<br />)"; } mysql_close($link); ?> </select> On the echo line, I have the error : [error] [client] PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/slimtest/views/nuevo.php on line 89 Maybe you can help, because I don't

SASS error when using % in property value together with for loop variable [duplicate]

北城余情 提交于 2019-12-02 07:40:41
This question already has an answer here: Adding a unit to a number in Sass 2 answers I'm trying to write some SASS (.scss) to generate CSS for a donation barometer (think progress bar). The CSS i need looks something like this: .p-0:after { left: 0%; } .p-1:after { left: 1%; } [... up to 100] The SASS I have is this: @for $i from 0 through 100 { .p-#{$i}:after {left: #{$i}%;} } Which gives me this error: Syntax error: Invalid CSS after "...r {left: #{$i}%": expected expression (e.g. 1px, bold), was ";}" The weird thing is that if I replace "%" in the above SASS with "px" SASS is totally cool