Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

How to try this script #1

Open
robertgarrigos opened this issue Sep 17, 2022 · 4 comments
Open

How to try this script #1

robertgarrigos opened this issue Sep 17, 2022 · 4 comments

Comments

@robertgarrigos
Copy link

robertgarrigos commented Sep 17, 2022

Hi Benjamin,

I would like to try this script, but have no experience on python nor with mongo. I wanted to use lando (lando.dev) to set up a local development environment, with no luck. Do you know lando? The problem I have is that the script cannot connect to mongodb because I don't know how to configure it. Any chances you know lando and how to configure it?

Thanks.

@BenjaminHerrera
Copy link
Member

Unfortunately, I am not experienced in lando nor have I heard of it. Could you show me what happens when you run the script via
py main.py when you clone the repo?

@robertgarrigos
Copy link
Author

The problem that I have is related to connecting to mongo within lando, not a problem with the script, so far.

@robertgarrigos
Copy link
Author

I managed to connect to mongo db. This is the message I'm having:

/var/www/.local/lib/python3.7/site-packages/pymongo/topology.py:177: UserWarning: MongoClient opened before fork. Create MongoClient only after forking. See PyMongo's documentation for details: https://pymongo.readthedocs.io/en/stable/faq.html#is-pymongo-fork-safe
  "MongoClient opened before fork. Create MongoClient only "
1 not added
/var/www/.local/lib/python3.7/site-packages/pymongo/topology.py:177: UserWarning: MongoClient opened before fork. Create MongoClient only after forking. See PyMongo's documentation for details: https://pymongo.readthedocs.io/en/stable/faq.html#is-pymongo-fork-safe
  "MongoClient opened before fork. Create MongoClient only "
2 not added
/var/www/.local/lib/python3.7/site-packages/pymongo/topology.py:177: UserWarning: MongoClient opened before fork. Create MongoClient only after forking. See PyMongo's documentation for details: https://pymongo.readthedocs.io/en/stable/faq.html#is-pymongo-fork-safe
  "MongoClient opened before fork. Create MongoClient only "
4 not added
/var/www/.local/lib/python3.7/site-packages/pymongo/topology.py:177: UserWarning: MongoClient opened before fork. Create MongoClient only after forking. See PyMongo's documentation for details: https://pymongo.readthedocs.io/en/stable/faq.html#is-pymongo-fork-safe
  "MongoClient opened before fork. Create MongoClient only "
3 not added
5 added | Verified
9 added | Verified
7 added | Verified
8 added | Verified
6 added | Verified
12 added | Verified
11 added | Verified
10 added | Verified
13 added | Verified
...

It looks like it's working with a few first error messages.

@BenjaminHerrera
Copy link
Member

Does the error message popup midway through the script's execution?

Additionally, at around line 230 of main.py, there's a section where it is commented out. Uncomment that section that says

        # traceback.print_exc()
        # print("\n")
        
        # # Log error
        # with open(f'logs/{song_id}.txt', 'w') as file:
        #     traceback.print_exc(file=file)

and create a logs folder in the root directory of the program. This section is involved in recording specific error messages without interrupting the script.

Drop the Mongo DB involved in saving the scrapped data and rerun the script to see what specific error is coming out.

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

No branches or pull requests

2 participants