rsokl / Learning_Python

Source material for Python Like You Mean it
https://www.pythonlikeyoumeanit.com/
Other
165 stars 54 forks source link

Minor Typos #141

Closed ArtichokeSap closed 4 years ago

ArtichokeSap commented 4 years ago

In Module 4, Class Methods, this example appears:

>>> dict.fromkeys("abcd")
{'a': 2.3, 'b': 2.3, 'c': 2.3, 'd': 2.3}

which would instead be the result of

>>> dict.fromkeys("abcd", 2.3)

If this kind of issue isn't helpful, sorry in advance. I've found a few of these, which I think are obvious to basically any reader, so it's more about professionalism than actual confusion. If this feedback is valuable, I'll submit the others (else: I won't clutter the submissions)

davidmascharka commented 4 years ago

Thanks for flagging this! Any typos or errors of this sort you find are very helpful. If you'd like to fix these, please do open a pull request. Otherwise, flagging these with issues here is awesome and we'll take care of them.

ArtichokeSap commented 4 years ago

I've been getting used to git and (private) GitHub pages, but only clones and local branches. I haven't done a pull request before, but if you can wait a few days, I'd be happy to make the changes and research a bit on GitHub push/pull, and then do the pull request. It'd be a good experience for me!

rsokl commented 4 years ago

Sounds good! Let us know if we can provide any guidance.

ArtichokeSap commented 4 years ago

First things first: Sorry to clutter up the Issue thread; what's the best way to reach out for help, that aren't problems with the Issue at hand?

I was trying to build the HTML so I could see changes/etc., and ran into an error with: pip install jupytext-1.3.0rc1 I did get pip install jupytext --upgrade to work (installs jupytext-1.4.2)

However, the plymi.convert_src_to_html("./Python") command doesn't seem to work; no _build directory seems to be created.

The import plymi command worked, and the plymi.convert_src_to_html function didn't error out; I just don't see that anything occurred, even though it paused for long enough to be doing something.

rsokl commented 4 years ago

No worries about cluttering the issue thread. This is a perfectly okay place to raise this issue.

First of all, it might not be necessary for you to build the html. If you simply install jupytext, you should be able to view the markdown file you are editing, but as a Jupyter notebook; that is a pretty faithful representation of what the HTML will ultimately look like. That being said, if you do want to build the HTML, I am happy to help.

ran into an error with: pip install jupytext-1.3.0rc1

I actually have a pull request up to update this so that shouldn't be a problem in the near future.

However, the plymi.convert_src_to_html("./Python") command doesn't seem to work; no _build directory seems to be created.

That's odd. All that command is doing is running:

python -m sphinx . _build -j4

from the appropriate directory. So this is more likely a sphinx issue than a plymi issue. Did anything print in the console when you ran this? What OS are you using?

ArtichokeSap commented 4 years ago

I'm "making progress," getting to new error messages.

It looks like my console wasn't in the plymi environment. I swapped over to pycharm, and sphinx runs now.

Though I have some version number warnings and errors: RemovedInSphinx40Warning: The app.add_stylesheet() is deprecated. Please use app.add_css_file() instead. app.add_stylesheet('my_theme.css')

RemovedInSphinx40Warning: The app.add_javascript() is deprecated. Please use app.add_js_file() instead. app.add_javascript("https://www.googletagmanager.com/gtag/js?id=UA-115029372-1")

RemovedInSphinx40Warning: The app.add_javascript() is deprecated. Please use app.add_js_file() instead. app.add_javascript("gtag.js")

And a few of these: RuntimeWarning: You are using an unsupported version of pandoc (2.1.3). Your version must be at least (1.12.1) but less than (2.0.0).

Eventually, it totally broke at 81% doing this.

reading sources... [ 81%] Module5_OddsAndEnds/WorkingWithFiles

C:\path\to\Learning_Python\Python\Module3_IntroducingNumpy\AdvancedIndexing.md:516: WARNING: Title level inconsistent:
Converting a Boolean Index-Array to Integer index-arrays: numpy.where
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Notebook error:
CellExecutionError in Module5_OddsAndEnds\WorkingWithFiles.md:
------------------
# glob all of the text files in the present directory
# that start with 'test' and end with '.txt'
 root_dir = Path('.')
 files = root_dir.glob('test*.txt')  # this produces a generator
<generator object Path.glob at 0x00000146CE118620>

# get a sorted list of the globbed paths
 sorted(files)
[PosixPath('test_0.txt'),
 PosixPath('test_1.txt'),
 PosixPath('test_apple.txt')]

# iterating over the generator directly 
 for file in root_dir.glob('test*.txt'):
     with open(file, 'r') as f:
         # do some processing
         pass
------------------

  File "<ipython-input-2-ff69bc1c4b9e>", line 3
    >>> root_dir = Path('.')
     ^
SyntaxError: invalid syntax

SyntaxError: invalid syntax (<ipython-input-2-ff69bc1c4b9e>, line 3)

You can ignore this error by setting the following in conf.py:
    nbsphinx_allow_errors = True

Would it make any sense to load a different version of pandoc or sphinx into the environment?

ArtichokeSap commented 4 years ago

I see now that all that code is from Globbing for Files.

Anyway, for now I changed the conf.py to

    nbsphinx_allow_errors = True

And I get some WARNING: Could not lex literal_block as "python". Highlighting skipped. warnings, but the _build directory actually gets made (and I couldn't find the difference from the current version online).

rsokl commented 4 years ago

These are all addressed by #142 - once I merge this of those errors will go away (however the lexing warnings will still be there, but those aren't a problem)

ArtichokeSap commented 4 years ago

So I made the tiny change (adding the , 2.3) and I have a commit (on my local branch "typo") that I can push, but don't have write access. I guess I'd like to know I'm doing it right, and then go back and do the other typos in a separate commit (which I guess I'd still do on my "typo" branch).

I think it's set up correctly, just that I don't have access to push even a branch?:

$ git remote -v
origin  git@github.com:rsokl/Learning_Python.git (fetch)
origin  git@github.com:rsokl/Learning_Python.git (push)

$ git push origin typos
ERROR: Permission to rsokl/Learning_Python.git denied to ArtichokeSap.
fatal: Could not read from remote repository.
rsokl commented 4 years ago

( #142 has been merged into master)

You do not have access to push a branch to my repository; this permission is only granted to those who have explicitly been added as collaborators to a repository. Instead, you will want to create your own copy of the repository on GitHub, which is known as a "fork", push your typo branch to that repository and then open a pull request into master of my repository.

You can read more details about this here: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork

ArtichokeSap commented 4 years ago

I could probably use a pointer to the proper etiquette for documenting pull requests; I've read up on commit messages, but it was truly a one-liner, so I kept that simple.

rsokl commented 4 years ago

Closed by #145