Closed jdx closed 8 years ago
cc @kennethreitz
@dickeyxxx is it showing output under regular foreman?
yes it does
I'm getting this same issue on OS X.
@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
Seems very likely I just don't have the bandwidth to fix it right now :)
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)
In outlet.go it waits for a new line to display anything. Happy to give you a commit bit if you like.
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.
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?
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
Set PYTHONUNBUFFERED to a non-empty string
https://docs.python.org/2/using/cmdline.html#envvar-PYTHONUNBUFFERED
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
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.
I'm also having problems getting proper stack traces from flask
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
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!
I think there is maybe a stdout flushing issue when using forego on windows. It doesn't display output from this django app: https://github.com/heroku/python-getting-started
It still functions, but it doesn't display any output. After I press ctrl-c, it does show one line of output.