Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

War and Peace doesn't parse #6

Closed
palewire opened this issue Aug 5, 2018 · 7 comments
Closed

War and Peace doesn't parse #6

palewire opened this issue Aug 5, 2018 · 7 comments

Comments

@palewire
Copy link

palewire commented Aug 5, 2018

wget http://www.gutenberg.org/files/2600/2600-0.txt
mv 2600-0.txt war-and-peace.txt
chapterize war-and-peace.txt
Traceback (most recent call last):
  File "/home/palewire/.virtualenvs/literary-notebooks/bin/chapterize", line 11, in <module>
    sys.exit(cli())
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/chapterize/chapterize.py", line 28, in cli
    bookObj = Book(book, nochapters)
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/chapterize/chapterize.py", line 43, in __init__
    self.chapters = self.getTextBetweenHeadings()
  File "/home/palewire/.virtualenvs/literary-notebooks/local/lib/python3.5/site-packages/chapterize/chapterize.py", line 174, in getTextBetweenHeadings
    nextHeadingLocation = self.headingLocations[i+1]
IndexError: list index out of range
@JonathanReeve
Copy link
Owner

That's odd, it works for me. Could you install the latest version (0.1.5) and let me know if it works now? (I just pushed my changes to PyPI, so it should 0.1.5 should be available through pip now.)

@palewire
Copy link
Author

palewire commented Aug 7, 2018

Same error. Did you run the same three lines of code I did above?

@palewire
Copy link
Author

palewire commented Aug 7, 2018

Here's what I just did.

# palewire @ ryon in ~/Code [10:34:32] 
$ mkdir chapterize

# palewire @ ryon in ~/Code [10:34:39] 
$ cd chapterize 

# palewire @ ryon in ~/Code/chapterize [10:34:42] 
$ pipenv shell
Creating a virtualenv for this project…
Using /home/palewire/.pyenv/versions/3.6.4/bin/python3.6 (3.6.4) to create virtualenv…
⠋Already using interpreter /home/palewire/.pyenv/versions/3.6.4/bin/python3.6
Using base prefix '/home/palewire/.pyenv/versions/3.6.4'
New python executable in /home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/bin/python3.6
Also creating executable in /home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/palewire/.local/share/virtualenvs/chapterize-dF68RRby
Creating a Pipfile for this project…
Spawning environment shell (/usr/bin/zsh). Use 'exit' to leave.
. /home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/bin/activate

# palewire @ ryon in ~/Code/chapterize [10:34:47] 
$ . /home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/bin/activate
(chapterize-dF68RRby) 
# palewire @ ryon in ~/Code/chapterize [10:34:47] 
$ pipenv install chapterize
Installing chapterize…
Looking in indexes: https://pypi.python.org/simple
Collecting chapterize
  Downloading https://files.pythonhosted.org/packages/cd/11/820644eb199a5fcb78a2dffb031abcae6c0d12197913e3c0b177889a9f18/chapterize-0.1.5.tar.gz
Collecting Click (from chapterize)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Building wheels for collected packages: chapterize
  Running setup.py bdist_wheel for chapterize: started
  Running setup.py bdist_wheel for chapterize: finished with status 'done'
  Stored in directory: /home/palewire/.cache/pip/wheels/a9/5c/5f/c0dd0b873376e7abab013af585bd8ac4e36a8b196dfe3b5d4d
Successfully built chapterize
Installing collected packages: Click, chapterize
Successfully installed Click-6.7 chapterize-0.1.5

Adding chapterize to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (cb552e)!
Installing dependencies from Pipfile.lock (cb552e)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/2 — 00:00:00
(chapterize-dF68RRby) 
# palewire @ ryon in ~/Code/chapterize [10:34:56] 
$ wget http://www.gutenberg.org/files/2600/2600-0.txt
--2018-08-07 10:35:01--  http://www.gutenberg.org/files/2600/2600-0.txt
Resolving www.gutenberg.org (www.gutenberg.org)... 152.19.134.47, 2610:28:3090:3000:0:bad:cafe:47
Connecting to www.gutenberg.org (www.gutenberg.org)|152.19.134.47|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3359542 (3.2M) [text/plain]
Saving to: ‘2600-0.txt’

2600-0.txt                                           100%[=====================================================================================================================>]   3.20M   627KB/s    in 6.6s    

2018-08-07 10:35:08 (494 KB/s) - ‘2600-0.txt’ saved [3359542/3359542]

(chapterize-dF68RRby) 
# palewire @ ryon in ~/Code/chapterize [10:35:08] 
$ mv 2600-0.txt war-and-peace.txt
(chapterize-dF68RRby) 
# palewire @ ryon in ~/Code/chapterize [10:35:09] 
$ chapterize war-and-peace.txt
Traceback (most recent call last):
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/bin/chapterize", line 11, in <module>
    sys.exit(cli())
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/chapterize/chapterize.py", line 29, in cli
    bookObj = Book(book, nochapters, stats)
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/chapterize/chapterize.py", line 44, in __init__
    self.chapters = self.getTextBetweenHeadings()
  File "/home/palewire/.local/share/virtualenvs/chapterize-dF68RRby/lib/python3.6/site-packages/chapterize/chapterize.py", line 184, in getTextBetweenHeadings
    nextHeadingLocation = self.headingLocations[i+1]
IndexError: list index out of range

@JonathanReeve
Copy link
Owner

Ok yeah, I tried this on a fresh Ubuntu box, and sure enough, I'm getting the same error. I'll look into this. I don't know why I'm not getting an error on Arch, but I am on Ubuntu.

@JonathanReeve
Copy link
Owner

I think I fixed it. Would you mind giving it another try, and letting me know if it works now?

@palewire
Copy link
Author

palewire commented Sep 9, 2018

No error!

@JonathanReeve
Copy link
Owner

Great! Glad to hear it. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants