473,467 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Streaming Data Error in .read() (HTTP/ICY) Possible Bug?

I playing around with streaming shoutcast mp3s.

Here is some sample code:

-----------------------
import httplib

############
# Put together the headers
headers = {"Icy-MetaData":"1"}

con = httplib.HTTPConnection('64.142.8.154', 8000)
con.request("GET", "/")
stream = con.getresponse()
print stream.status,stream.reason
print stream.read()
-----------------------

For which i get error:

bash-2.05b$ ./woxy_saver.py
200
Traceback (most recent call last):
File "./woxy_saver.py", line 21, in ?
print stream.read()
File "C:\python24\lib\httplib.py", line 463, in read
s = self._safe_read(self.length)
File "C:\python24\lib\httplib.py", line 545, in _safe_read
chunk = self.fp.read(amt)
File "C:\python24\lib\httplib.py", line 1273, in read
return s + self._file.read(amt - len(s))
TypeError: unsupported operand type(s) for -: 'str' and 'int'
bash-2.05b$

It seems somehow amt is turning into a str.

Is this a bug in httplib.py or there something wrong with my code?
Cheers
- Haz

Jul 19 '05 #1
1 2028
I should purhaps mention that i am basically trying to translate this.

nc ~= telnet

#!/bin/sh

nc sc1.liquidviewer.com 9012 <<EOF
GET / HTTP/1.0
Icy-MetaData:1
EOF

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John | last post by:
Hi all, I have an (well, what I think to be, at least) interesting question: Is it possible to stream data down to the client and, after a certain amount of data has been streamed, allow the...
6
by: | last post by:
Hi all, is there a better way to stream binary data stored in a table in sql 2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We noticed that in certain heavy load scenarios,...
3
by: Vijay | last post by:
Hi Folks, I having one issue, in my application I am going to use the server push for streaming the data by keeping the connection open. At client side, i am having the XMhttprequest object (i.e...
0
by: thesti | last post by:
hello, i'm trying to import data from an excel file to a SQL Server 2005 table using the Integration Services Project. i have Visual Studio 2005 installed as i drag the data flow task and...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.