Jump to content

python script stopped working


Recommended Posts

I've used this for a while with no issues.  Now I'm not sure what has changed, Alfred doesn't seem to want to run the script now.  Nothing is wrong with the script itself because I can run it through vs code or my terminal just fine. 

 

Here is bash script

#!/bin/bash
source /Path/to/Scripts/'Link Scraper'/venv/bin/activate
python /Path/to/Scripts/'Link Scraper'/format_notes.py

 

Here is the error

[11:37:37.411] ERROR: TCPA Tools[Run Script] DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Traceback (most recent call last):
  File "/Path/to/Scripts/Link Scraper/format_notes.py", line 2, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

 

Pandas is installed because I can run the script in my terminal with the same commands...Any suggestions?

Link to comment

It’s about the full path to the tool. python isn’t a full path. But that may not apply here, there’s a reason multiple approaches are listed. The difference is in your shell environment, that’s what you have to replicate. If you’re using the script just for yourself, use the third method at the bottom to load your shell files.

 

To get help beyond that you’ll have to provide more information about your setup. What’s your macOS version? What’s your python version? How have you installed the module?

 

Edited by vitor
Link to comment

I'm afraid I don't understand.

 

I updated 

 

#!/bin/bash
source "${HOME}/.zshrc" /Path/to/Scripts/'Link Scraper'/venv/bin/activate
python /Path/to/Scripts/'Link Scraper'/format_notes.py

and 

#!/bin/bash
source "${HOME}/.zshrc" /Path/to/Scripts/'Link Scraper'/venv/bin/activate
python3 /Path/to/Scripts/'Link Scraper'/format_notes.py

  with no effect

 

if I go directly to the terminal, open that venv, then try to install it, it says it's installed.  However running the script from the terminal yields the same error. works fin in vs code however with the same venv running.   

 

I'm running mac os 13.2.1, on a m1 macbook.  

 

Working on it further, it seems like it works in vs code even when it's not in the venv....

Link to comment

You’re using Bash but sourcing a Zsh file.

 

As per above, without the requested information it’s not possible to help further.

 

And please provide the real workflow you’re using. Hiding the paths is only going to make helping more difficult.

Link to comment

Indeed. Think of it like going to the doctor and saying your stomach hurts. There are a myriad of reasons for that so the doctor needs more information, like what do you eat and how regularly. If you don’t provide the information, there’s nothing which can be done to help. A few guidelines and generic medications can be prescribed but it’s impossible to know for sure what the cause is without knowing more. Like every body is different, every computer is configured a different way. Without knowing more about your setup all we can do is shoot in the dark which isn’t productive for any party.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...