SyntaxError: no viable alternative at input 'Field' in python

Asked by adhithi

hey,
im trying to excute a python script, which contain text fetched from a webpage.
I tried to print the fetched text in the console but im getting the following error.

"SyntaxError: no viable alternative at input 'Field'"

please help!!!

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

you have written down some illegal Python (Syntax error).

Usually some delimiter (: , " ...) is missing in the line mentioned or the line before.

Revision history for this message
adhithi (adhithi) said :
#2

my script is very simple, im just trying to print the text fetched from a webpage.
eg: if "hey how r u" is the text fetched from the webpage ,

my script is just like this,

a = "hey how r u"
print a

Revision history for this message
masuo (masuo-ohara) said :
#3

There should be a cause at the line where you type "Field"
Where is "Field"?

Revision history for this message
adhithi (adhithi) said :
#4

i dont type anything, the previous eg is just that i showed how its should work but coming to the error which contains "field" is a title that is fetched from a webpage

Revision history for this message
RaiMan (raimund-hocke) said :
#5

the snippet from comment #2 surely does not produce the mentioned syntax error.

So what is your problem?

Revision history for this message
adhithi (adhithi) said :
#6

Let me explain you:
 im suppose to fetch a text from a webpage and search for a string(i have a list of strings to compare) in the fetched text,

but when i try to print the fetched text it gives me that error mentioned in the heading,
Because of this its neither getting printed to the console nor im able to compare my list of string against what is fetched.

Revision history for this message
adhithi (adhithi) said :
#7

still the same error.....Some one please help!!!!!

Revision history for this message
RaiMan (raimund-hocke) said :
#8

Again: we do not see your code here, that produces the error.

so please paste the complete code togethher with the complete error message!

Revision history for this message
adhithi (adhithi) said :
#9

if $($[errorpagelist[$(i)]]) in $(REQUIRED):
    print "error found"
else:
    print "error not found"

Here, the errorpagelist is a list that is created using my own data and REQUIRED is the variable the contains data fetched from webpage.

the error is as follows:

The script failed with the following message:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.0-dev9\jython\Lib\qftest.py", line 91, in runscript
    qfcommon.runscript(ctxt, code, exContext, dir)
  File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.0-dev9\jython\Lib\qfcommon.py", line 1012, in runscript
    cpl = compile(code, file, "exec")
  File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.0-dev9\jython\Lib\qfcommon.py", line 1012, in runscript
    cpl = compile(code, file, "exec")
  File "C:\Users\adhithya.d\.qftest\_script3416551849628207373.py", line 1
    if h2Error_404--Not_Found in Field Value
                                      ^
SyntaxError: no viable alternative at input 'Value'

the 'value' in the error is a part of data that is fetched from webpage.

Revision history for this message
RaiMan (raimund-hocke) said :
#10

this is not standard Python ($ must be some private implementation whatever)

I seems to interpolate something from variables.

so looking at the error, then in an expression like
if xyz in abc

xyz and abc must be valid expressions or variable names.

this is not the case here.

you have to evaluate what the package/library qftest\qftest-4.1.0-dev9 needs as input, to work properly.

... and finally, this is not a Sikuli question.
either ask the owner of the package or look somewherelse in the net

Revision history for this message
adhithi (adhithi) said :
#11

anyway thanks!!!!!

Can you help with this problem?

Provide an answer of your own, or ask adhithi for more information if necessary.

To post a message you must log in.