Scrapy "ImportError" when running inside bash script

Andrew

I have a Python script (blah.py), where the first line is:

import scrapy

When I write "python blah.py" it works fine.

I have a .sh script:

#!/bin/bash
python blah.py

When I execute the .sh script with "sh blah.sh" I get the error:

ImportError: No module named scrapy

I can't figure out why. I want to execute it from within a .sh file because I am executing some other commands after the Python script.

eLRuLL

Looks like you could be running both on different environments.

Check in terminal when running python blah.py which python version you are using with which python, and the same for the bash script, before the line of python blah.py type which python.

Make sure both paths are the same for them to work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

BASH | Syntax error when running script on a different computer?

From Dev

Error when running curl inside script (No such file or directory)

From Dev

Resolve the ImportError: No modules named , when running grinder script

From Dev

Invalid option when running bash script on Debian 7

From Dev

Getting the functionality of the scrapy crawl command when running a spider from a script

From Dev

running sqlite3 script inside bash

From Dev

Scrapy (Python) throws ImportError when running with cron

From Dev

Running scrapy from inside Python script - CSV exporter doesn't work

From Dev

Error when running script in bash

From Dev

Declare a variable when running the script bash

From Dev

GVM returns error when running in bash script

From Dev

Permission Denied when running BASH that downloads and runs External Script

From Dev

When running bash script that calls another script getting EOF error

From Dev

How to access the contents of a file that is used as an argument when running a bash script?

From Dev

Two errors when running ssh in a bash script

From Dev

Running bash script with sudo, and git inside of it

From Dev

How to change bash script output when the script is running?

From Dev

Issue when running wget inside a bash script with an url stored in a variable

From Dev

bash script error when running executing openvpn service

From Dev

warning when running simple shell script in bash for ubuntu on windows

From Dev

Getting the functionality of the scrapy crawl command when running a spider from a script

From Dev

Unable to stat itself when running a bash script

From Dev

Bash script not sleeping when running scripts in parallel

From Dev

How to output commands when running lynx from bash script?

From Dev

Bash script fails when running command with embedded quotes (source parameters)

From Dev

Running a script inside another script

From Dev

command not found when running in docker bash script

From Dev

Bash script, stopping a process running forever when a line is printed

From Dev

Chaining command when running bash script

Related Related

  1. 1

    BASH | Syntax error when running script on a different computer?

  2. 2

    Error when running curl inside script (No such file or directory)

  3. 3

    Resolve the ImportError: No modules named , when running grinder script

  4. 4

    Invalid option when running bash script on Debian 7

  5. 5

    Getting the functionality of the scrapy crawl command when running a spider from a script

  6. 6

    running sqlite3 script inside bash

  7. 7

    Scrapy (Python) throws ImportError when running with cron

  8. 8

    Running scrapy from inside Python script - CSV exporter doesn't work

  9. 9

    Error when running script in bash

  10. 10

    Declare a variable when running the script bash

  11. 11

    GVM returns error when running in bash script

  12. 12

    Permission Denied when running BASH that downloads and runs External Script

  13. 13

    When running bash script that calls another script getting EOF error

  14. 14

    How to access the contents of a file that is used as an argument when running a bash script?

  15. 15

    Two errors when running ssh in a bash script

  16. 16

    Running bash script with sudo, and git inside of it

  17. 17

    How to change bash script output when the script is running?

  18. 18

    Issue when running wget inside a bash script with an url stored in a variable

  19. 19

    bash script error when running executing openvpn service

  20. 20

    warning when running simple shell script in bash for ubuntu on windows

  21. 21

    Getting the functionality of the scrapy crawl command when running a spider from a script

  22. 22

    Unable to stat itself when running a bash script

  23. 23

    Bash script not sleeping when running scripts in parallel

  24. 24

    How to output commands when running lynx from bash script?

  25. 25

    Bash script fails when running command with embedded quotes (source parameters)

  26. 26

    Running a script inside another script

  27. 27

    command not found when running in docker bash script

  28. 28

    Bash script, stopping a process running forever when a line is printed

  29. 29

    Chaining command when running bash script

HotTag

Archive