Questions tagged [bytesio]

A stream implementation using an in-memory bytes buffer.

Refer to BytesIO class details in Python's docs.

258 questions
2
votes
2 answers

Reading in pydub AudioSegment from url. BytesIO returning "OSError [Errno 2] No such file or directory" on heroku only; fine on localhost

EDIT 1 for anyone with the same error: installing ffmpeg did indeed solve that BytesIO error EDIT 1 for anyone still willing to help: my problem is now that when I AudioSegment.export("filename.mp3", format="mp3"), the file is made, but has size 0…
Mark
  • 1,285
  • 1
  • 19
  • 28
1
vote
1 answer

Python3.0: tokenize & BytesIO

When attempting to tokenize a string in python3.0, why do I get a leading 'utf-8' before the tokens start? From the python3 docs, tokenize should now be used as follows: g = tokenize(BytesIO(s.encode('utf-8')).readline) However, when attempting…
brad
  • 73,826
  • 21
  • 73
  • 85
1
vote
0 answers

Passing BytesIO to BufferedReader results in warning message

I am trying to create a BufferedReader from a BytesIO object but my IDE (PyCharm) is warning me that BufferedReader Expected type 'RawIOBase', got 'BytesIO' instead. The logic seems to work but I'd like to solve this properly if there is a way to do…
keith.g
  • 900
  • 9
  • 19
1
vote
1 answer

How do I copy bytes to/from SharedMemory into BytesIO?

I am creating a SharedMemory object, where data is being written to it in an I/O bound process for subsequent processing by a separate compute-bound process. In subsequent processing of the data I want to be able to read and write with a file-like…
John
  • 10,837
  • 17
  • 78
  • 141
1
vote
0 answers

Merge two wave files as bytes, so they play at the same time in Python?

I'm making a Discord bot, and I need to record audio from a voice channel and produce one single wave audio file, where all the audio is playing at the same time, like the Discord client hears when others are in the channel. I'm using the Pycord…
ConchDev
  • 79
  • 7
1
vote
1 answer

Error loading base64 image: PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO

I have a string base64 image that need to convert so then I can read it as image to analyze with pytesseract: import base64 import io from PIL import Image import pytesseract import sys base64_string =…
MrPimiBurn
  • 15
  • 5
1
vote
1 answer

How to read data from azure blob storage with BlobServiceClient without downloading rather by using BytesIO stream

I don't want to get any downloads just get stream of data which I can read using Pandas later >! the parameters of BlobServiceClient are correctly provided BSC= BlobServiceClient() self.stream = BytesIO() BSC.get_blob_client( …
ar d
  • 51
  • 5
1
vote
0 answers

How to display image saved as string in python doc-x

I have a django web application which creates an image on the POST call and I want this image to be inserted into a word document that the user can download. Currently the function that creates the image is something like this: def create_image(): …
RobMcC
  • 392
  • 2
  • 7
  • 20
1
vote
1 answer

How to refresh the window to show a new image in pysimlegui

When I click the button to change the image, the window refresh does not work. I don't know how to implement it properly. How can I refresh the api with the button. I'm new to pysimplegui; can somebody point me in the correct direction? from io…
1
vote
1 answer

How to query bytearray data in pandas dataframe using duckdb?

df_image : is a pandas data frame with a column labelled 'bytes', which contains image data in bytearray format. I display the images as follows: [display(Image(copy.copy(BytesIO(x)).read(),width=300,height=170)) for x in df_image['bytes']] Now I…
tinker
  • 11
  • 2
1
vote
1 answer

Good way to capture an image to memory and serve it with flask

I have a Raspberry Pi with an attached webcam and a python flask-script that sends out some informations as jsons and under the route /image.jpg an image. In the past i capture the image to storage and served it from there but I feel it's more…
globus243
  • 710
  • 1
  • 15
  • 31
1
vote
1 answer

How to fix BytesIO numpy image array returning blank?

I'm trying to save a Matplotlib plot to an array using BytesIO as suggested here: Matplotlib save plot to NumPy array. Here is my code import lightkurve import matplotlib.pyplot as plt import numpy as np import io def download(search): lc =…
1
vote
1 answer

create multiple workbooks with xlsxwriter in Django/Python

I am in the middle of a reporting function which will break up reports into different workbooks then zip the files and send them out to users. At this time, I get a successful book for the second iteration, but the first iteration seems to be…
jjulian91
  • 41
  • 3
1
vote
0 answers

Compare an object in memory to a local file

When getting a file from the internet, reading it into memory, not a file, and then comparing the contents of it to a local file. The efficiency and ease of filecmp is what I'm looking to achieve or find but so far I'm unable to increment through…
clivet268
  • 43
  • 1
  • 5
1
vote
1 answer

TorchServe: How to convert bytes output to tensors

I have a model that is served using TorchServe. I'm communicating with the TorchServe server using gRPC. The final postprocess method of the custom handler defined returns a list which is converted into bytes for transfer over the network. The post…
Mohit Motwani
  • 4,662
  • 3
  • 17
  • 45