-2

In my Visual Code Studio running python3.6 - my code is saved as "Langemead12Test.py" w/ lines as:

!C:\Users\Bones\Anaconda3\python.exe [1]def readFastq(SRR835775_1.first1000.fastq)

Red Error underline def [pylint] E0001:invalid syntax (, line 3).

In Anaconda command prompt running python3.6:

File "Langmead12Test.py", line 3 def readFastq(SRR835775_1.first1000.fastq) ^ SyntaxError: invalid syntax

Question(s): I'm a total newb here but I can't seem to understand why VCS throws an error under def and my anaconda command line prompt throws error at the . within the fastq filename. Are these independent errors or different representations of the same error? All thoughts and hints are welcome.

Background: I am attempting to execute exercise in ADS1: Practical: Working with sequencing reads. Ben Langmead's Youtube class on reading fastq files (filename = SRR835775_1.first1000.fastq).

CKE
  • 1,533
  • 19
  • 18
  • 29
Triage
  • 21
  • 1
  • 3
  • You probably want quotes around `SRR835775_1.first1000.fastq`, and they're probably the same error. – jedwards Jun 19 '18 at 18:52
  • Can you provide a minimal example of the code? It looks like you are trying to define a function. The function's parameters are simple names, no dots. I can't say whether that's the only error without a view of the code. – tdelaney Jun 19 '18 at 19:13

1 Answers1

0

You have 2 syntax error in one line:

1.Missing "" or this '' before and after your string

2.You forget to put ":" and the end of the line: Correct syntax:

def readFastq(filename="SRR835775_1.first1000.fastq"):

Read this carefully please:

https://docs.python.org/3/tutorial/introduction.html#strings

https://docs.python.org/3/tutorial/controlflow.html#defining-functions

And after that read and learn everything from there:

https://docs.python.org/3/tutorial/index.html

KJG
  • 31
  • 4
  • if you still getting error pls post your code as asked before – KJG Jun 19 '18 at 19:27
  • Thank you for your reply; in the tutorial I was attempting to replicate the user is in Jupyter notebook and doesn't use quotes or : I gather this Jupyter has some way of departing form normal syntax? – Triage Jun 19 '18 at 20:45
  • Here is the new error from Anaconda Prompt File "Langmead12Test.py", line 3 def readFastq('SRR835775_1.first1000.fastq'): ^ SyntaxError: invalid syntax – Triage Jun 19 '18 at 20:51
  • My bad i made a mistake edited the code in my answer test it now. because you still not posted the actual code which reads the file in your function i guessing the argument name is filename in your function :) if not change it accordingly – KJG Jun 20 '18 at 01:10
  • I dont know I never used Jupyter nor Anaconda But thats what Jupyter.org says so it should work:"When executing code in IPython, all valid Python syntax works as-is" so try update the code from my edited answer and see if it works – KJG Jun 20 '18 at 01:17