Giter Site home page Giter Site logo

Comments (2)

elacuesta avatar elacuesta commented on July 18, 2024

You need to deploy a custom Docker image in order to do have arbitrary commands executed.

Regarding scrapy-playwright, I have a sample project that demonstrates how to use it on Scrapy Cloud. Disclaimer: this is a personal project, it is NOT an officially supported Scrapy stack.

from shub.

hamzza-K avatar hamzza-K commented on July 18, 2024

I tried to hack a workaround by messing with the scripts argument using setup.py

script.py


import subprocess
def run_bash_command(command):
    try:
        result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
        return result.stdout
    except subprocess.CalledProcessError as e:
        print(f"Error running command: {e}")
        return None

commands = ["export PATH=/app/python/bin:$PATH", "playwright install", "playwright install-deps"]

for command in commands:
    output = run_bash_command(command)
    if output is not None:
        print("Command output:")
        print(output)``` 


I'm not sure why this isn't setting the path right to correct the following error in the logs.
  `WARNING: The scripts pip, pip3 and pip3.8 are installed in '/app/python/bin' which is not on PATH.`
0: 2023-07-26 12:39:49 INFO Log opened.
1: 2023-07-26 12:39:50 INFO [stdout] Command output:
2: 2023-07-26 12:39:50 INFO [stdout]
3: 2023-07-26 12:39:50 INFO [stdout] Error running command: Command 'playwright install' returned non-zero exit status 127.
4: 2023-07-26 12:39:50 INFO [stdout] Error running command: Command 'playwright install-deps' returned non-zero exit status 127.

This works fine on my local environment. Can you explain why this won't work here?

Thanks for sharing the Dockerfile setup, I'm afraid that's the only way for me to get what I want.  I really wish there was a feature of opening a bash shell just like in Heroku. 

from shub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.