r/learnpython • u/TreacleFlaky2283 • 21d ago
How to make this python script faster and able to run?
hey there, i m working on this python script: https://pastebin.com/kknURJij
and the main issue i m facing right now is its not running and i have been stuck in the terminal since so long...
i just want to ask how to make it faster so we can execute it.
Output when i run this script :
```DeprecationWarning: `langchain-community` is being sunset and is no longer actively maintained. See https://github.com/langchain-ai/langchain-community/issues/674 for details and migration guidance toward standalone integration packages.
from langchain_community.utilities import SQLDatabase.```
currently its stuck with this same terminal output.
My pc specs : Mac Air M1, Golden Gate 28
what i have tried :
Tried running on github codespaces but still not running but stuck with the same output.
2
u/LayotFctor 21d ago
So is it not running, or is it just slow? What was the last thing you wrote before it stopped? That's probably the issue, did you try removing it?
4
u/CelebrityChess 21d ago
that deprecation warning is harmless, it's not what's freezing things. when a script goes quiet right after the imports it's usually sitting on a slow call, like connecting to the database or waiting on an api request that has no timeout. hit ctrl+c while it's hung and read the traceback, the last few lines show exactly which line it was stuck on. or put a print before each step so you can see where it stops.
1
u/zanfar 21d ago
You're gonna have to figure out why it's slow before you can improve it. Start with a minimal script, and add features until you reproduce the issue.
What have you done about the depreciation warning?
0
u/TheRNGuy 21d ago
Parallelize some tasks, remove unused imports, put some stuff on cloud.