Server embed how to raising UnsupportedOperation error.

Hello everyone.

I used this howto back on version 0.12.14:

Now I’ve tried to run the script again, but it gives me this error:

File “”, line 1, in

runfile(‘C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py’, wdir=‘C:/Users/Daniel/Documents/wctba/year vs year’)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 705, in runfile

execfile(filename, namespace)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 102, in execfile

exec(compile(f.read(), filename, ‘exec’), namespace)

File “C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py”, line 60, in

app.run(port=8000)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\flask\app.py”, line 938, in run

cli.show_server_banner(self.env, self.debug, self.name, False)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\flask\cli.py”, line 629, in show_server_banner

click.echo(message)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\click\utils.py”, line 259, in echo

file.write(message)

UnsupportedOperation: not writable

here is my setup:

Windows 10 pro 64 bits

Python: 3.6.5 on Anaconda

Bokeh 0.12.16

Tornado: 5.0.2

Flask: 1.0.2

Someone knows what is happening? Should I create an Issue on github?

Hi,

I'm not sure, this error is actually coming from Flask, so offhand I am not sure it is a Bokeh problem, per se. AFAIK click is a command line UI library, so this seems to be saying that Flask cannot output its startup info to the command window. Do other Flask apps work for you on your system?

THanks,

Bryan

···

On Jun 7, 2018, at 13:16, [email protected] wrote:

Hello everyone.

I used this howto back on version 0.12.14:
https://github.com/bokeh/bokeh/blob/0.12.16/examples/howto/server_embed/flask_embed.py

Now I've tried to run the script again, but it gives me this error:

  File "<ipython-input-7-37ae4da65fda>", line 1, in <module>
    runfile('C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py', wdir='C:/Users/Daniel/Documents/wctba/year vs year')

  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py", line 60, in <module>
    app.run(port=8000)

  File "C:\Users\Daniel\Anaconda3\lib\site-packages\flask\app.py", line 938, in run
    cli.show_server_banner(self.env, self.debug, self.name, False)

  File "C:\Users\Daniel\Anaconda3\lib\site-packages\flask\cli.py", line 629, in show_server_banner
    click.echo(message)

  File "C:\Users\Daniel\Anaconda3\lib\site-packages\click\utils.py", line 259, in echo
    file.write(message)

UnsupportedOperation: not writable

here is my setup:
Windows 10 pro 64 bits
Python: 3.6.5 on Anaconda
Bokeh 0.12.16
Tornado: 5.0.2
Flask: 1.0.2

Someone knows what is happening? Should I create an Issue on github?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ae47632-1182-485c-bfc6-ebaa73b51892%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thank you Bryan, I’ve bootstrapped a hello flask, and it runs normally.
I’ll look more carefully into this, as I am not used to Flask and only choose to use it to render bokeh plots.

···

Em quinta-feira, 7 de junho de 2018 17:27:32 UTC-3, Bryan Van de ven escreveu:

Hi,

I’m not sure, this error is actually coming from Flask, so offhand I am not sure it is a Bokeh problem, per se. AFAIK click is a command line UI library, so this seems to be saying that Flask cannot output its startup info to the command window. Do other Flask apps work for you on your system?

THanks,

Bryan

On Jun 7, 2018, at 13:16, [email protected] wrote:

Hello everyone.

I used this howto back on version 0.12.14:

https://github.com/bokeh/bokeh/blob/0.12.16/examples/howto/server_embed/flask_embed.py

Now I’ve tried to run the script again, but it gives me this error:

File “”, line 1, in

runfile('C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py', wdir='C:/Users/Daniel/Documents/wctba/year vs year')

File “C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 705, in runfile

execfile(filename, namespace)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 102, in execfile

exec(compile(f.read(), filename, 'exec'), namespace)

File “C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py”, line 60, in

app.run(port=8000)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\flask\app.py”, line 938, in run

cli.show_server_banner(self.env, self.debug, [self.name](http://self.name), False)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\flask\cli.py”, line 629, in show_server_banner

click.echo(message)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\click\utils.py”, line 259, in echo

file.write(message)

UnsupportedOperation: not writable

here is my setup:

Windows 10 pro 64 bits

Python: 3.6.5 on Anaconda

Bokeh 0.12.16

Tornado: 5.0.2

Flask: 1.0.2

Someone knows what is happening? Should I create an Issue on github?


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ae47632-1182-485c-bfc6-ebaa73b51892%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

FWIW I tried this locally on OSX and it works fine for me. So if you have the chance, it would be useful to know:

* does it work for you on a different OS?
* does it work for you on a different Windows machine?

It would be good to know if maybe this is a real issue, but specific to windows, or if it is something has to do with your specific set up.

Thanks,

Bryan

···

On Jun 7, 2018, at 13:59, Celso Neto <[email protected]> wrote:

Thank you Bryan, I've bootstrapped a hello flask, and it runs normally.
I'll look more carefully into this, as I am not used to Flask and only choose to use it to render bokeh plots.

Em quinta-feira, 7 de junho de 2018 17:27:32 UTC-3, Bryan Van de ven escreveu:
Hi,

I'm not sure, this error is actually coming from Flask, so offhand I am not sure it is a Bokeh problem, per se. AFAIK click is a command line UI library, so this seems to be saying that Flask cannot output its startup info to the command window. Do other Flask apps work for you on your system?

THanks,

Bryan

> On Jun 7, 2018, at 13:16, celso...@gmail.com wrote:
>
> Hello everyone.
>
> I used this howto back on version 0.12.14:
> https://github.com/bokeh/bokeh/blob/0.12.16/examples/howto/server_embed/flask_embed.py
>
> Now I've tried to run the script again, but it gives me this error:
>
>
> File "<ipython-input-7-37ae4da65fda>", line 1, in <module>
> runfile('C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py', wdir='C:/Users/Daniel/Documents/wctba/year vs year')
>
> File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
> execfile(filename, namespace)
>
> File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
> exec(compile(f.read(), filename, 'exec'), namespace)
>
> File "C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py", line 60, in <module>
> app.run(port=8000)
>
> File "C:\Users\Daniel\Anaconda3\lib\site-packages\flask\app.py", line 938, in run
> cli.show_server_banner(self.env, self.debug, self.name, False)
>
> File "C:\Users\Daniel\Anaconda3\lib\site-packages\flask\cli.py", line 629, in show_server_banner
> click.echo(message)
>
> File "C:\Users\Daniel\Anaconda3\lib\site-packages\click\utils.py", line 259, in echo
> file.write(message)
>
> UnsupportedOperation: not writable
>
> here is my setup:
> Windows 10 pro 64 bits
> Python: 3.6.5 on Anaconda
> Bokeh 0.12.16
> Tornado: 5.0.2
> Flask: 1.0.2
>
>
> Someone knows what is happening? Should I create an Issue on github?
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ae47632-1182-485c-bfc6-ebaa73b51892%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/25ac4671-558a-40de-8f13-e5181e479669%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hello again Bryan,

After testing on 2 different linux machines and not raising the error, unfortunately I couldn’t test on another Windows machine… but found a venturesome workaround based on this stackoverflow question:

https://stackoverflow.com/questions/50604718/unsupportedoperation-not-writable

The problem seems to reside on Anaconda3\lib\site-packages\click\utils.py

On line 243:

ANSI-style support. If there is no message or we are dealing with

# bytes nothing is happening.  If we are connected to a file we want

# to strip colors.  If we are on windows we either wrap the stream

# to strip the color or we use the colorama support to translate the

# ansi codes to API calls.

if message and not is_bytes(message):

    color = resolve_color_default(color)

    if should_strip_ansi(file, color):

        message = strip_ansi(message)

    elif WIN:

        if auto_wrap_for_ansi is not None:

            file = auto_wrap_for_ansi(file)

        elif not color:

            message = strip_ansi(message)

if message:

    file.write(message)

file.flush()

Commenting the lines marked in red makes the server run without errors.

Still need to test on a Windows Machine without Anaconda, but my guess is that it seems to be a bug with Anaconda.

···

Em quinta-feira, 7 de junho de 2018 18:10:11 UTC-3, Bryan Van de ven escreveu:

Hi,

FWIW I tried this locally on OSX and it works fine for me. So if you have the chance, it would be useful to know:

  • does it work for you on a different OS?

  • does it work for you on a different Windows machine?

It would be good to know if maybe this is a real issue, but specific to windows, or if it is something has to do with your specific set up.

Thanks,

Bryan

On Jun 7, 2018, at 13:59, Celso Neto [email protected] wrote:

Thank you Bryan, I’ve bootstrapped a hello flask, and it runs normally.

I’ll look more carefully into this, as I am not used to Flask and only choose to use it to render bokeh plots.

Em quinta-feira, 7 de junho de 2018 17:27:32 UTC-3, Bryan Van de ven escreveu:

Hi,

I’m not sure, this error is actually coming from Flask, so offhand I am not sure it is a Bokeh problem, per se. AFAIK click is a command line UI library, so this seems to be saying that Flask cannot output its startup info to the command window. Do other Flask apps work for you on your system?

THanks,

Bryan

On Jun 7, 2018, at 13:16, [email protected] wrote:

Hello everyone.

I used this howto back on version 0.12.14:
https://github.com/bokeh/bokeh/blob/0.12.16/examples/howto/server_embed/flask_embed.py

Now I’ve tried to run the script again, but it gives me this error:

File “”, line 1, in
runfile(‘C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py’, wdir=‘C:/Users/Daniel/Documents/wctba/year vs year’)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 705, in runfile
execfile(filename, namespace)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”, line 102, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)

File “C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py”, line 60, in
app.run(port=8000)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\flask\app.py”, line 938, in run
cli.show_server_banner(self.env, self.debug, self.name, False)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\flask\cli.py”, line 629, in show_server_banner
click.echo(message)

File “C:\Users\Daniel\Anaconda3\lib\site-packages\click\utils.py”, line 259, in echo
file.write(message)

UnsupportedOperation: not writable

here is my setup:
Windows 10 pro 64 bits
Python: 3.6.5 on Anaconda
Bokeh 0.12.16
Tornado: 5.0.2
Flask: 1.0.2

Someone knows what is happening? Should I create an Issue on github?


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ae47632-1182-485c-bfc6-ebaa73b51892%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/25ac4671-558a-40de-8f13-e5181e479669%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

Given what you say, this definitely seems like a bug or misconfiguration of click, and not to do with Bokeh. I would suggest taking this information to their GitHub tracker support forum.

Thanks,

Bryan

···

On Jun 13, 2018, at 06:17, Celso Neto <[email protected]> wrote:

Hello again Bryan,

After testing on 2 different linux machines and not raising the error, unfortunately I couldn't test on another Windows machine... but found a venturesome workaround based on this stackoverflow question:
python - UnsupportedOperation: not writable - Stack Overflow

The problem seems to reside on Anaconda3\lib\site-packages\click\utils.py

On line 243:
    # ANSI-style support. If there is no message or we are dealing with
    # bytes nothing is happening. If we are connected to a file we want
    # to strip colors. If we are on windows we either wrap the stream
    # to strip the color or we use the colorama support to translate the
    # ansi codes to API calls.
    if message and not is_bytes(message):
        color = resolve_color_default(color)
        if should_strip_ansi(file, color):
            message = strip_ansi(message)
        elif WIN:
            if auto_wrap_for_ansi is not None:
                file = auto_wrap_for_ansi(file)
            elif not color:
                message = strip_ansi(message)

    if message:
        file.write(message)
    file.flush()

Commenting the lines marked in red makes the server run without errors.

Still need to test on a Windows Machine without Anaconda, but my guess is that it seems to be a bug with Anaconda.

Em quinta-feira, 7 de junho de 2018 18:10:11 UTC-3, Bryan Van de ven escreveu:
Hi,

FWIW I tried this locally on OSX and it works fine for me. So if you have the chance, it would be useful to know:

* does it work for you on a different OS?
* does it work for you on a different Windows machine?

It would be good to know if maybe this is a real issue, but specific to windows, or if it is something has to do with your specific set up.

Thanks,

Bryan

> On Jun 7, 2018, at 13:59, Celso Neto <[email protected]> wrote:
>
> Thank you Bryan, I've bootstrapped a hello flask, and it runs normally.
> I'll look more carefully into this, as I am not used to Flask and only choose to use it to render bokeh plots.
>
>
>
> Em quinta-feira, 7 de junho de 2018 17:27:32 UTC-3, Bryan Van de ven escreveu:
> Hi,
>
> I'm not sure, this error is actually coming from Flask, so offhand I am not sure it is a Bokeh problem, per se. AFAIK click is a command line UI library, so this seems to be saying that Flask cannot output its startup info to the command window. Do other Flask apps work for you on your system?
>
> THanks,
>
> Bryan
>
> > On Jun 7, 2018, at 13:16, celso...@gmail.com wrote:
> >
> > Hello everyone.
> >
> > I used this howto back on version 0.12.14:
> > https://github.com/bokeh/bokeh/blob/0.12.16/examples/howto/server_embed/flask_embed.py
> >
> > Now I've tried to run the script again, but it gives me this error:
> >
> >
> > File "<ipython-input-7-37ae4da65fda>", line 1, in <module>
> > runfile('C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py', wdir='C:/Users/Daniel/Documents/wctba/year vs year')
> >
> > File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
> > execfile(filename, namespace)
> >
> > File "C:\Users\Daniel\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
> > exec(compile(f.read(), filename, 'exec'), namespace)
> >
> > File "C:/Users/Daniel/Documents/wctba/year vs year/flask_embed.py", line 60, in <module>
> > app.run(port=8000)
> >
> > File "C:\Users\Daniel\Anaconda3\lib\site-packages\flask\app.py", line 938, in run
> > cli.show_server_banner(self.env, self.debug, self.name, False)
> >
> > File "C:\Users\Daniel\Anaconda3\lib\site-packages\flask\cli.py", line 629, in show_server_banner
> > click.echo(message)
> >
> > File "C:\Users\Daniel\Anaconda3\lib\site-packages\click\utils.py", line 259, in echo
> > file.write(message)
> >
> > UnsupportedOperation: not writable
> >
> > here is my setup:
> > Windows 10 pro 64 bits
> > Python: 3.6.5 on Anaconda
> > Bokeh 0.12.16
> > Tornado: 5.0.2
> > Flask: 1.0.2
> >
> >
> > Someone knows what is happening? Should I create an Issue on github?
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ae47632-1182-485c-bfc6-ebaa73b51892%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/25ac4671-558a-40de-8f13-e5181e479669%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d29a0b8c-80d5-4575-a327-50b79518a95e%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.