Skip to main content
781 votes
21 answers
894k views

PHP parse/syntax errors; and how to solve them

Everyone runs into syntax errors. Even experienced programmers make typos. For newcomers, it's just part of the learning process. However, it's often easy to interpret error messages such as: PHP ...
2032 votes
27 answers
3.7m views

How do I get PHP errors to display?

I have checked my PHP ini file (php.ini) and display_errors is set and also error reporting is E_ALL. I have restarted my Apache webserver. I have even put these lines at the top of my script, and it ...
Abs's user avatar
  • 57.8k
91 votes
3 answers
507k views

How can I fix MySQL error #1064?

When issuing a command to MySQL, I'm getting error #1064 "syntax error". What does it mean? How can I fix it?
eggyal's user avatar
  • 126k
53 votes
6 answers
160k views

f-strings giving SyntaxError?

I tried this code, following along with a tutorial: my_name = 'Zed A. Shaw' print(f"Let's talk about {my_name}.") But I get an error message highlighting the last line, like so: print(...
Alexander Coffman's user avatar
549 votes
10 answers
3.2m views

Error "(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape" [duplicate]

I'm trying to read a CSV file into Python (Spyder), but I keep getting an error. My code: import csv data = open("C:\Users\miche\Documents\school\jaar2\MIK\2.6\vektis_agb_zorgverlener") ...
Miesje's user avatar
  • 5,487
274 votes
11 answers
314k views

No visible cause for "Unexpected token ILLEGAL"

I'm getting this JavaScript error on my console: Uncaught SyntaxError: Unexpected token ILLEGAL This is my code: var foo = 'bar';​ It's super simple, as you can see. How could it be ...
bfavaretto's user avatar
  • 72.1k
64 votes
4 answers
1.2m views

Why do I get "SyntaxError: invalid syntax" in a line with perfectly valid syntax?

This is the line of code: guess = Pmin+(Pmax-Pmin)*((1-w**2)*fi1+(w**2)*fi2) Pmin, Pmax, w, fi1 and fi2 have all been assigned finite values at this point, so why is there an error? When I remove ...
Pearl Philip's user avatar
79 votes
3 answers
136k views

Why am I getting "invalid syntax" from an f-string? [duplicate]

I cannot get f-strings to work in Python 3. I tried this at the REPL: In [1]: state = "Washington" In [2]: state Out[2]: 'Washington' In [3]: my_message = f"I live in {state}" ...
Sven E's user avatar
  • 868
69 votes
4 answers
136k views

json Uncaught SyntaxError: Unexpected token :

Trying to make a call and retrieve a very simple, one line, JSON file. $(document).ready(function() { jQuery.ajax({ type: 'GET', url: 'http://wncrunners.com/admin/colors.json' , ...
paparush's user avatar
  • 1,348
108 votes
22 answers
396k views

Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL

I'm trying to connect with PostgreSQL database through Laravel in order to do a php artisan migrate but doesn't seem to be directed since it's reading the database name of MySQL. Here are the ...
Hyperion's user avatar
  • 1,163
463 votes
10 answers
583k views

How to correct TypeError: Unicode-objects must be encoded before hashing?

I have this error: Traceback (most recent call last): File "python_md5_cracker.py", line 27, in <module> m.update(line) TypeError: Unicode-objects must be encoded before hashing when I try ...
JohnnyFromBF's user avatar
  • 10.2k
22 votes
2 answers
12k views

Python cannot handle numbers string starting with 0. Why?

I just executed the following program on my python interpreter: >>> def mylife(x): ... if x>0: ... print(x) ... else: ... print(-x) ... >>> ...
user avatar
248 votes
13 answers
292k views

Ternary operators in JavaScript without an "else"

I've always had to put null in the else conditions that don't have anything. Is there a way around it? For example, condition ? x = true : null; Basically, is there a way to do the following? ...
Oscar Godson's user avatar
  • 32.7k
62 votes
8 answers
373k views

syntax error when using command line in python [duplicate]

I am having trouble using the command line. I have a script test.py (which only contains print("Hello.")), and it is located in the map C:\Python27. In my system variables, I have specified ...
Johanna's user avatar
  • 1,039
63 votes
2 answers
104k views

C: for loop int initial declaration

Can someone elaborate on the following gcc error? $ gcc -o Ctutorial/temptable.out temptable.c temptable.c: In function ‘main’: temptable.c:5: error: ‘for’ loop initial declaration used outside C99 ...
Midnight Blue's user avatar

15 30 50 per page
1
2 3 4 5
45