joenano / rpscrape

Scrape horse racing results data and racecards.
140 stars 57 forks source link

Code Update Issue #82

Closed patem2 closed 2 years ago

patem2 commented 2 years ago

Hi,

I'm not sure if there is an issue or if this is something local, but when I try to update when prompted I'm getting the following error:

Update available. Do you want to update? Y/N y From https://github.com/4A47/rpscrape

I haven't made any changes to the README.md file or the update file?

Hopefully it's nothing I'm doing :-)

BW

joenano commented 2 years ago

Can you paste the output of git statusand git diff just for reference.

Then from the main rpscrape folder try git checkout README.md scripts/utils/update.py and then run rpscrape again.

patem2 commented 2 years ago

Thanks for the reply, please see below:

GIT Status:

On branch master Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded. (use "git pull" to update your local branch)

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: .gitignore modified: README.md modified: courses/_courses modified: courses/_regions modified: requirements.txt modified: scripts/racecards.py modified: scripts/rpscrape.py modified: scripts/utils/argparser.py modified: scripts/utils/async_funcs.py modified: scripts/utils/completer.py modified: scripts/utils/course.py modified: scripts/utils/date.py modified: scripts/utils/lxml_funcs.py modified: scripts/utils/pedigree.py modified: scripts/utils/race.py modified: scripts/utils/region.py modified: scripts/utils/settings.py modified: scripts/utils/update.py modified: settings.toml

Untracked files: (use "git add ..." to include in what will be committed) Ground Types/

no changes added to commit (use "git add" and/or "git commit -a")

GIT DIFF:

warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in README.md. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in courses/_courses. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in courses/_regions. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in requirements.txt. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/racecards.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/rpscrape.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/argparser.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/async_funcs.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/completer.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/course.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/date.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/lxml_funcs.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/pedigree.py. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in scripts/utils/race.py. :

patem2 commented 2 years ago

When I tried to run the script again its highlighting the Windows root folder issue:

Traceback (most recent call last): File "rpscrape.py", line 147, in main() File "rpscrape.py", line 106, in main check_for_update() File "rpscrape.py", line 24, in check_for_update update = Update() File "C:\Users\markp\rpscrape\scripts\utils\update.py", line 8, in init self.root_dir = Path.cwd().split('/utils')[0] AttributeError: 'WindowsPath' object has no attribute 'split'

joenano commented 2 years ago

Probably best to just delete the folder and clone again. Move anything you want to keep temporarily and put it back after cloning.

patem2 commented 2 years ago

Thanks mate I’ll try that! 😃

patem2 commented 2 years ago

All sorted bud :-)

Do I need to do something specific on the user_settings TOML file as when scraping it seems to be picking up the standard fields?

joenano commented 2 years ago

By default all the usual data is scraped, the user_settings is just for some extra fields that were requested, and it enables people to get the exact data that they want. You can set the fields to true or false and change the order, and that will be reflected in the csv.

patem2 commented 2 years ago

Thanks for the note, I’m not sure the updated settings are being picked up as I’ve tried to change both files and it’s not being picked up e.g. raceID, horseID etc?

The CSV saved seems to be the default setting when it writes the file (both TOML files have been opened in notepad, adjusted and saved).

Note this is using the command GB 2021 flat as an example.

joenano commented 2 years ago

you shouldnt change the default_settings file as it will be overwritten on any update, its meant as a backup