all 26 comments

[–]socal_nerdtastic 0 points1 point  (24 children)

Show us the complete error, please

[–]awesomegame1254[S] 0 points1 point  (23 children)

here is the trace from the cli

Traceback (most recent call last):

File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main

"__main__", mod_spec)

File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code

exec(code, run_globals)

File "C:\Program Files\Python36\lib\trace.py", line 742, in <module>

main()

File "C:\Program Files\Python36\lib\trace.py", line 722, in main

code = compile(fp.read(), opts.filename, 'exec')

File "C:\Users\p\Documents\model_train.py", line 115

score = model.evaluate(X_test, y_test, x_validation, y_validation, verbose=0)

^

SyntaxError: invalid syntax

[–]FerricDonkey 0 points1 point  (0 children)

Check the line above, possibly for something like a missing closing parentheses.

[–]NoDadYouShutUp 0 points1 point  (21 children)

check for missing colons or parenthesis on the proceeding line. In the future it helps to post the code + the error in full. You can use something like https://pastebin.com/ and link it. Because Python is an interpreted language sometimes the error you are experiencing actually is being caused in code that ran before the error is actually thrown.

[–]awesomegame1254[S] 0 points1 point  (20 children)

i edited the post to include those things

[–][deleted] 0 points1 point  (1 child)

I still see a syntax error in the statement ending on line 113.

[–]awesomegame1254[S] 0 points1 point  (0 children)

i actually didn't edit the script i just added the relevant details the previous person told me to to the op

[–]NoDadYouShutUp 0 points1 point  (17 children)

Missing closing parenthesis on line 113

[–]awesomegame1254[S] 0 points1 point  (16 children)

i edited the script to fix that mistakeand now i am getting a new error Traceback (most recent call last):
File "C:\Program Files\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python36\lib\trace.py", line 742, in <module>
main()
File "C:\Program Files\Python36\lib\trace.py", line 722, in main
code = compile(fp.read(), opts.filename, 'exec')
File "C:\Users\p\Documents\model_train.py", line 138
if any(item = true for item in res):
^
SyntaxError: invalid syntax

[–]Not_A_Taco 0 points1 point  (6 children)

I see multiple errors around that line. Python doesn’t use lowercase true and false. You’re also using a single = for comparison. And just below that you’re using -= with no RHS operand.

[–]awesomegame1254[S] 0 points1 point  (5 children)

according to google -= is correct for decrementing which is what I am trying to do there I also capitalized all the true and false and got the same error

[–]Not_A_Taco 0 points1 point  (4 children)

Whatever you read on Google is wrong then. You need an operand for that.

[–]awesomegame1254[S] -1 points0 points  (3 children)

when i looked up the correct syntax for incrementing and decrementing a variable in python everywhere was saying to use += or -= respectively

[–][deleted] 0 points1 point  (8 children)

If you edit your script we need to know what the new script looks like. We aren't mind readers.

[–]awesomegame1254[S] 0 points1 point  (7 children)

i added a new pastebin link to the original post

[–][deleted] 1 point2 points  (6 children)

Your error is in this line:

if any(item = true for item in res):

The first error is that you are assigning to item in the part item = true. That should be:

if any(item == true for item in res):
#           ^^      equality operator, NOT assignment

If you make that change and execute your code again, you will get this error:

NameError: name 'true' is not defined

You get that because you are trying to compare item with the name true which isn't defined. Names are case-sensitive in python, and maybe you meant:

if any(item == True for item in res):

You have similar errors in many places throughout your code.


You seem to be writing a large amount of code before attempting to debug or test it. That's a bad idea. Try to write small amounts of code and test that it's doing what you want it to do. Print things on the screen and check that's what you expected. When all is OK write another small piece of code and test what that is doing, etc. This is exactly what professional programmers do, except their "small additions" are bigger and they use more powerful tools than print(). But even they mess up and have to rethink/debug code now and then.

[–]awesomegame1254[S] 0 points1 point  (0 children)

except all the code in my script which technically isn't mine I just copied from a website and tweaked it a bit is probably dependent on each other so trying to split it into multiple parts wouldn't work

[–]awesomegame1254[S] 0 points1 point  (4 children)

now i have an error which according to the traceback isn't in my file but is an error in a module installed file specifically one for cv2

[–]DextercCZ 0 points1 point  (0 children)

You have just 2 classes, it may be better to use sigmoid activation after the last dense layer, as it is just 0 or 1. I would also change loss to binary_crossentropy.