Giter Site home page Giter Site logo

python output not displaying about forego HOT 17 CLOSED

ddollar avatar ddollar commented on June 21, 2024
python output not displaying

from forego.

Comments (17)

jdxcode avatar jdxcode commented on June 21, 2024

cc @kennethreitz

from forego.

kron4eg avatar kron4eg commented on June 21, 2024

@dickeyxxx is it showing output under regular foreman?

from forego.

jdxcode avatar jdxcode commented on June 21, 2024

yes it does

from forego.

jamesbeith avatar jamesbeith commented on June 21, 2024

I'm getting this same issue on OS X.

from forego.

bgentry avatar bgentry commented on June 21, 2024

@ddollar I feel like this is probably identical to an issue you fixed w/ Convox a while ago that's caused by python never outputting newlines

from forego.

ddollar avatar ddollar commented on June 21, 2024

Seems very likely I just don't have the bandwidth to fix it right now :)

from forego.

jdxcode avatar jdxcode commented on June 21, 2024

mind elaborating more on what the issue was? I could take a pass at fixing it. btw expect more bug reports and forego usage, we switched to forego in all the Heroku documentation (via the heroku local command)

from forego.

ddollar avatar ddollar commented on June 21, 2024

In outlet.go it waits for a new line to display anything. Happy to give you a commit bit if you like.

from forego.

kennethreitz avatar kennethreitz commented on June 21, 2024

It's not that python doesn't "output" newlines, it's that Python doesn't flush stdout when it prints a newline. Most languages do.

from forego.

brandonb927 avatar brandonb927 commented on June 21, 2024

We stopped using forego after about an hour because of this issue :( Anything we can add to our django stack to allow us to use forego?

from forego.

jdxcode avatar jdxcode commented on June 21, 2024

I'm trying to figure out how to get the subprocess to flush in order to fix this, but you might be able to fix this in your procfile by adding 2>&1 to the end of the command

from forego.

ddollar avatar ddollar commented on June 21, 2024

Set PYTHONUNBUFFERED to a non-empty string

https://docs.python.org/2/using/cmdline.html#envvar-PYTHONUNBUFFERED

from forego.

jdxcode avatar jdxcode commented on June 21, 2024

PYTHONUNBUFFERED doesn't seem to work:

env PYTHONUNBUFFERED=0 forego start -f fixtures/python/Procfile
forego | starting out.1 on port 5000
out.1  | foo

here's the fixture I'm using: https://github.com/ddollar/forego/compare/master...dickeyxxx:python-sync?expand=1

that branch also fixes the problem, but I'm not sure it's the best solution

from forego.

kennethreitz avatar kennethreitz commented on June 21, 2024

PYTHONUNBUFFERED is for controlling python's pipe buffering, and while it can be useful on the consumption end of this problem (e.g. writing forego in python), it should have no effect on this.

The problem is that go is only printing lines when they are flushed, and python simply does not flush lines usually.

from forego.

franciscolourenco avatar franciscolourenco commented on June 21, 2024

I'm also having problems getting proper stack traces from flask

from forego.

franciscolourenco avatar franciscolourenco commented on June 21, 2024

My procfile:

web: gunicorn hello:app
dev: python hello.py

With forego start dev I don't get proper stack traces.
With forego run python hello.py I get full stack trace.

Ruby foreman works fine in both cases.
Aren't both commands supposed to have exactly the same result?

EDIT: The output: https://gist.github.com/aristidesfl/6a2127af781abb77ad9d
EDIT2: Flask app with an error https://github.com/aristidesfl/forego-flask-stacktrace-example

from forego.

ddollar avatar ddollar commented on June 21, 2024

For now forego is going to assume that subprocesses flush their output regularly. If any Pythonistas want to take a swing at fixing this globally please feel free to submit a PR!

from forego.

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.