Answers.Body: <p>Personally I think its late and we're all tired.</p>
  <blockquote>
  <p>&quot;FileNotFoundError: [Errno 2] No such file or directory: 'ls_orchid.fasta'&quot;</p>
  </blockquote>
  <p>The traceback is pointing to line 2, the SeqIO as you point out.</p>
  <p>In my opinion, the script should be in the same directory as the fasta file. You know how to identify the path in bash (<code>pwd</code> or <code>echo $PWD</code>), although you must be using Windows (Anaconda has \ rather than /). Alternatively the file names has a typo. You know the</p>
  <pre><code>for seq_record in SeqIO.parse(&quot;~\path\ls_orchid.fasta&quot;, &quot;fasta&quot;): # where path is the dir(s) leading to ls_orchid.fasta, but obviously use / if its Linux.
  </code></pre>
  <p>I would assume you can alternatively dump the .ipynb file in the location where the fasta file is.</p>
  <p>As personal choice I prefer a formal IDE such as 'Visual Studio Code' or &quot;PyCharm&quot;. In my personal opinion, I am aware some will disagree, Jupyter notebook good is for running code on a remote commercial server for data science work. However, the traceback - which you clearly have activated - looks good. I can see that you're Anaconda3 installation looks good, you must be using Windows (which I've never worked with) and you're running Jupiter from Anaconda3 ... so cool.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-11T14:56:55.773Z
Answers.Text: Thanks, Michael, these are my first steps with biopython - thought it would work ok with win10 jupyter nb, and yeah checked the path - it was wrong so now everything's fine. Agree 100% that Linux is better.
Answers.UserDisplayName: Dmitrii Trubetskoy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-11T00:08:22.020Z
Answers.LastActivityDate: 2020-11-11T00:18:05.663Z
Answers.LastEditDate: 2020-11-11T00:18:05.663Z
Answers.UserDisplayName: M__
Body: <p>I am trying to follow the tutorial from from the Biopython website <a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html" rel="nofollow noreferrer">here</a>  and I am right at the beginning (2.4.1), where I am trying a <em>Simple FASTA parsing example</em> which is</p>
  <pre><code>from Bio import SeqIO
  for seq_record in SeqIO.parse(&quot;ls_orchid.fasta&quot;, &quot;fasta&quot;):
      print(seq_record.id)
      print(repr(seq_record.seq))
      print(len(seq_record))
  </code></pre>
  <p>For an unknown reason, I get the following error:</p>
  <pre><code>---------------------------------------------------------------------------
  FileNotFoundError                         Traceback (most recent call last)
  &lt;ipython-input-19-c64128d7dcfd&gt; in &lt;module&gt;
        1 from Bio import SeqIO
  ----&gt; 2 for seq_record in SeqIO.parse(&quot;ls_orchid.fasta&quot;, &quot;fasta&quot;):
        3     print(seq_record.id)
        4     print(repr(seq_record.seq))
        5     print(len(seq_record))
  
  ~\Anaconda3\lib\site-packages\Bio\SeqIO\__init__.py in parse(handle, format, alphabet)
      605     iterator_generator = _FormatToIterator.get(format)
      606     if iterator_generator:
  --&gt; 607         return iterator_generator(handle)
      608     if format in AlignIO._FormatToIterator:
      609         # Use Bio.AlignIO to read in the alignments
  
  ~\Anaconda3\lib\site-packages\Bio\SeqIO\FastaIO.py in __init__(self, source, alphabet, title2ids)
      181             raise ValueError(&quot;The alphabet argument is no longer supported&quot;)
      182         self.title2ids = title2ids
  --&gt; 183         super().__init__(source, mode=&quot;t&quot;, fmt=&quot;Fasta&quot;)
      184 
      185     def parse(self, handle):
  
  ~\Anaconda3\lib\site-packages\Bio\SeqIO\Interfaces.py in __init__(self, source, alphabet, mode, fmt)
       45             raise ValueError(&quot;The alphabet argument is no longer supported&quot;)
       46         try:
  ---&gt; 47             self.stream = open(source, &quot;r&quot; + mode)
       48             self.should_close_stream = True
       49         except TypeError:  # not a path, assume we received a stream
  
  FileNotFoundError: [Errno 2] No such file or directory: 'ls_orchid.fasta'
  </code></pre>
  <p>I am using a Jupyter Notebook.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-10T23:15:59.407Z
Comments.Text: There's something wrong with your copy of https://raw.githubusercontent.com/biopython/biopython/master/Doc/examples/ls_orchid.fasta
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-11T15:05:48.457Z
Comments.Text: Is there any way not to download a .fasta file every time but say scrape it directly from pubmed genome? This string https://www.ncbi.nlm.nih.gov/nuccore/FJ211590.1?report=fasta isn't accepted as a valid argument. Thank you.
Comments.UserDisplayName: Dmitrii Trubetskoy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-11T16:33:49.740Z
Comments.Text: Just download the file
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-11T16:54:18.317Z
Comments.Text: Thanks, this means there's no other way?
Comments.UserDisplayName: Dmitrii Trubetskoy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-11T16:55:32.463Z
Comments.Text: If you wanted to program in a cache you could, but that’sd be excessive IMO.
Comments.UserDisplayName: Devon Ryan
Tags: <python><phylogenetics><phylogeny><seqio>
Title: Why SeqIO.parse method isn't working?
ThreadText: # Why SeqIO.parse method isn't working?
  
  (Asked by: username_0 on 2020-11-10)
  
  I am trying to follow the tutorial from from the Biopython website [here](http://biopython.org/DIST/docs/tutorial/Tutorial.html) and I am right at the beginning (2.4.1), where I am trying a *Simple FASTA parsing example* which is
  
  ```
  from Bio import SeqIO
  for seq_record in SeqIO.parse("ls_orchid.fasta", "fasta"):
      print(seq_record.id)
      print(repr(seq_record.seq))
      print(len(seq_record))
  
  ```
  
  For an unknown reason, I get the following error:
  
  ```
  ---------------------------------------------------------------------------
  FileNotFoundError                         Traceback (most recent call last)
  <ipython-input-19-c64128d7dcfd> in <module>
        1 from Bio import SeqIO
  ----> 2 for seq_record in SeqIO.parse("ls_orchid.fasta", "fasta"):
        3     print(seq_record.id)
        4     print(repr(seq_record.seq))
        5     print(len(seq_record))
  
  ~\Anaconda3\lib\site-packages\Bio\SeqIO\__init__.py in parse(handle, format, alphabet)
      605     iterator_generator = _FormatToIterator.get(format)
      606     if iterator_generator:
  --> 607         return iterator_generator(handle)
      608     if format in AlignIO._FormatToIterator:
      609         # Use Bio.AlignIO to read in the alignments
  
  ~\Anaconda3\lib\site-packages\Bio\SeqIO\FastaIO.py in __init__(self, source, alphabet, title2ids)
      181             raise ValueError("The alphabet argument is no longer supported")
      182         self.title2ids = title2ids
  --> 183         super().__init__(source, mode="t", fmt="Fasta")
      184 
      185     def parse(self, handle):
  
  ~\Anaconda3\lib\site-packages\Bio\SeqIO\Interfaces.py in __init__(self, source, alphabet, mode, fmt)
       45             raise ValueError("The alphabet argument is no longer supported")
       46         try:
  ---> 47             self.stream = open(source, "r" + mode)
       48             self.should_close_stream = True
       49         except TypeError:  # not a path, assume we received a stream
  
  FileNotFoundError: [Errno 2] No such file or directory: 'ls_orchid.fasta'
  
  ```
  
  I am using a Jupyter Notebook.
  
  **Tags:** python, phylogenetics, phylogeny, seqio
  
  > **Comments:**
  > **username_1**: There's something wrong with your copy of https://raw.githubusercontent.com/biopython/biopython/master/Doc/examples/ls_orchid.fasta  
  > **username_0**: Is there any way not to download a .fasta file every time but say scrape it directly from pubmed genome? This string https://www.ncbi.nlm.nih.gov/nuccore/FJ211590.1?report=fasta isn't accepted as a valid argument. Thank you.  
  > **username_1**: Just download the file  
  > **username_0**: Thanks, this means there's no other way?  
  > **username_1**: If you wanted to program in a cache you could, but that’sd be excessive IMO.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-11-11. Score: 2 | Accepted answer
  
  Personally I think its late and we're all tired.
  
  > "FileNotFoundError: [Errno 2] No such file or directory: 'ls\_orchid.fasta'"
  
  The traceback is pointing to line 2, the SeqIO as you point out.
  
  In my opinion, the script should be in the same directory as the fasta file. You know how to identify the path in bash (`pwd` or `echo $PWD`), although you must be using Windows (Anaconda has \ rather than /). Alternatively the file names has a typo. You know the
  
  ```
  for seq_record in SeqIO.parse("~\path\ls_orchid.fasta", "fasta"): # where path is the dir(s) leading to ls_orchid.fasta, but obviously use / if its Linux.
  
  ```
  
  I would assume you can alternatively dump the .ipynb file in the location where the fasta file is.
  
  As personal choice I prefer a formal IDE such as 'Visual Studio Code' or "PyCharm". In my personal opinion, I am aware some will disagree, Jupyter notebook good is for running code on a remote commercial server for data science work. However, the traceback - which you clearly have activated - looks good. I can see that you're Anaconda3 installation looks good, you must be using Windows (which I've never worked with) and you're running Jupiter from Anaconda3 ... so cool.
  
  > **Comments:**
  > **username_0**: Thanks, Michael, these are my first steps with biopython - thought it would work ok with win10 jupyter nb, and yeah checked the path - it was wrong so now everything's fine. Agree 100% that Linux is better.  
  
  ---
  
  