# from lxml import etree; import module2dbk; print module2dbk.xsl_transform(etree.parse('test-ccap/col10614/index.cnxml'), []); Error: bash: syntax error near unexpected token `('
The error message indicates that the script gets executed by bash, not python. Try adding #!/usr/bin/python as the first line of the file.
bash: syntax error near unexpected token. It means you are typing a mongo shell command into bash shell. You must connect to your cluster with the mongo command first. system (system) closed September 14, 2022, 12:52am #3.
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided. This might be a simple typo.
Unexpected TokenThis is simply down to a syntax error (your fault, I'm afraid). Perhaps you forgot the ':' after a conditional branch or there is an unclosed parenthesis left somewhere in your code? Python scripts are broken down into 'tokens' which helps the program navigate the logic of your code.
add #!/usr/bin/env python
at the top of your script, or call your script using python myscript.py
Are you typing this at the unix command prompt? You should be doing this inside the python environment, ie. type python
at the prompt and work from there.
Also, no ;
needed at the end of the line in Python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With