Re: Path / Listing and os.walk problem.

2010-08-26 Thread Peter Otten
Alban Nona wrote:

 Hi
 
 So here is my problem:
 
 I have my render files that are into a directory like this:
 
 c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0001.exr
 c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0002.exr
 c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0003.exr
 
 c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0001.exr
 c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0002.exr
 c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0003.exr
 
 True is, there is like 1000 Files is the directory (C:\log\renderfiles\)
 
 What Iam looking to is to extract the first part of the filenames as a
 list, but I dont want the script to extract it 1000times, I mean I dont
 need it to extract HPO7_SEQ004_031_VDM_AMB 150 times, because there is 150
 Frames. (not sure if its clear tought)
 
 so far, I would like the list to look lik:
 
 [HPO7_SEQ004_031_VDM_DIF, HPO7_SEQ004_031_VDM_AMB, etc...]
 
 
 I start to think about that, to try to use a
 
 for (path, dirs, files) in os.walk(path):
 list.append(files)
 
 
 but this kind of thing will just append the whole 1000 files, thing that I
 dont want, and more complicated I dont want the thing after AMB or DIF
 in the name files to follow.
 (thing I can delete using a split, if I read well ?)
 
 
 I trying to search on internet for answer, but seems I find nothing about
 it.
 Someone can help me with that please, show me the way or something ?

You can use glob. Assuming the files are all in one directory:

import os
import glob

folder = rC:\log\renderfiles

# find files that end with _V001.0001.exr
pattern = os.path.join(folder, *_V001.0001.exr)
files = glob.glob(pattern)

# remove the directory
names = [os.path.basename(f) for f in files]

# remove everything after and including the last occurence of _
names = [n.rpartition(_)[0] for n in names]

print \n.join(sorted(names))

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Iterative vs. Recursive coding

2010-08-26 Thread Bruno Desthuilliers

BartC a écrit :
Steven D'Aprano st...@remove-this-cybersource.com.au wrote in 
message news:4c6f8edd$0$28653$c3e8...@news.astraweb.com...

On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:



I onced worked in a shop (Win32 desktop / accouting applications mainly)
where I was the only guy that could actually understand recursion. FWIW,
I also was the only guy around that understood hairy (lol) concepts
like callback functions, FSM, polymorphism, hashtables, linked lists,
ADTs, algorithm complexity etc...



Was there anything they *did* understand, or did they just bang on the
keyboard at random until the code compiled? *wink*


You underestimate how much programming (of applications) can be done 
without needing any of this stuff.


From personal experience : almost nothing worth being maintained. I'm 
talking about complex domain-specific applications here - not shell 
scripts or todo-lists.



Needless to say, I didn't last long !-)


And rightly so :)


I guess they wanted code that could be maintained by anybody.


The code base was an unmaintainable, undecipĥerable mess loaded with 
global state (litteraly *hundreds* of global variables), duplication, 
dead code, and enough WTF to supply thedailywtf.com for years - to make 
a long story short, the perfect BigBallOfMudd. FWIW, the company didn't 
last long neither - they just kept on introducing ten new bugs each time 
they fixed one.


--
http://mail.python.org/mailman/listinfo/python-list


Python Editor or IDE ActiveX control

2010-08-26 Thread Sathish S
Hi Ppl,

Is there any python IDE or editor that has an ActiveX control which could be
embed in other Windows applications. I'm basically looking to write a
application that can show the indentations of python, change the color of
keywords etc on a application, which will save this python script and run it
from command prompt.

Thanks,
Sathish
-- 
http://mail.python.org/mailman/listinfo/python-list


Webcam support

2010-08-26 Thread Navkirat Singh
Hi Guys,

I am programming a web centric app in python for customer, which needs to click 
a snap of the customer and forward the pic to the server via POST. I am not 
very familiar with how I can achieve this. Any direction would be much 
appreciated.

Regards,
Nav
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Webcam support

2010-08-26 Thread Chris Rebert
On Thu, Aug 26, 2010 at 1:35 AM, Navkirat Singh navkir...@gmail.com wrote:
 Hi Guys,

 I am programming a web centric app in python for customer, which needs to 
 click a snap of the customer and forward the pic to the server via POST. I am 
 not very familiar with how I can achieve this. Any direction would be much 
 appreciated.

I think Flash (*shudder*) has some sort of webcam API.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: seach for pattern based on string

2010-08-26 Thread richie05 bal
On Aug 24, 11:05 pm, Alex Willmer a...@moreati.org.uk wrote:
 On Aug 24, 5:33 pm, richie05 bal richie8...@gmail.com wrote:

  i am starting to learn python and I am stuck with query I want to
  generate with python
  File looks something like this
  TRACE: AddNewBookD {bookId 20, noofBooks 6576, authorId 41,
  publishingCompanyId 7}
  TRACE: AddNewBookD {bookId 21, noofBooks 6577, authorId 42,
  publishingCompanyId 8}

  I want to first search for AddNewBookD
  if found
     store bookId, noofBooks, authorId and publishingCompanyId

  I know how to search for only AddNewBookD or find the pattern bookId
  20, noofBooks 6576, authorId 41, publishingCompanyId 7 but I don't
  know how search one based on another.

 Using a regular expression I would perform a match against each line.
 If the match fails, it will return None. If the match succeeds it
 returns a match object with which you can extract the values

  import re
  pattern = re.compile(r'TRACE: AddNewBookD \{bookId (\d+), noofBooks 
  (\d+), authorId (\d+), publishingCompanyId (\d+)\}\s*')
  s = '''TRACE: AddNewBookD {bookId 20, noofBooks 6576, authorId 41, 
  publishingCompanyId 7} '''
  pattern.match(s)

 _sre.SRE_Match object at 0xa362f40 # If the match failed this would
 be None m = pattern.match(s)
  m.groups()

 ('20', '6576', '41', '7')



 So your code to store the result would be inside an if m: block

 HTH, Alex

thanks Alex. exactly what i was looking for.
-- 
http://mail.python.org/mailman/listinfo/python-list


pil and reportlab: image compression

2010-08-26 Thread steph
Hi group,

I've written a small application that puts images into a pdf document.
It works ok, but my problem is that the pdf-files become quite huge,
bigger than the original jpegs. The problem seems to arise because I
use PIL to resize the pictures - and the images seem to get
uncompressed in the process. Unfortunately I have not found a way to
compress them again before rendering them to the pdf. Any clues?

Thanks,
Stephan
-- 
http://mail.python.org/mailman/listinfo/python-list


bug? pkgutil.walk_packages returns packages that result in an ImportError

2010-08-26 Thread Chris Withers

Hi All,

From the docs of pkgutils.walk_packages:

'onerror' is a function which gets called with one argument (the
name of the package which was being imported) if any exception
occurs while trying to import a package.  If no onerror function is
supplied, ImportErrors are caught and ignored, while all other
exceptions are propagated, terminating the search.


My expectation of this is that if onerrors is left as None, names 
yielded will be importable.


However, because the yield is before the import check, you can get 
packages returned that are not importable.


This feels at odds with the docs above and I think is a bug.

If the yield were dropped to befoer the import check, we wouldn't have 
this problem.


what do others think?

cheers,

Chris

--
http://mail.python.org/mailman/listinfo/python-list


Re: matplotlib pyplot contourf with 1-D array (vector)

2010-08-26 Thread becky_s
On Aug 26, 1:52 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Wed, 25 Aug 2010 14:57:33 -0700 (PDT), becky_s rda.se...@gmail.com
 declaimed the following in gmane.comp.python.general:



  px,py = p(mesolon, mesolat)

         For my elucidation, what does that      p(x,y)  actually do? 
 Especially
 as you appear to expect the result to be split into separate x and y
 afterwards? I can't find it defined in either matplotlib nor numpy.

p was declared as a basemap object in the previous statement, which
sets up a map projection.  Calling p(mesolon, mesolat) converts those
lons, lats to units in that map projection and stores them in px,py.
(See http://matplotlib.sourceforge.net/matplotlib.toolkits.basemap.basemap.html
for more info on basemap.)



  pyplot_api.html#matplotlib.pyplot.contourf) I thought that as long as
  px, py, and rain are the same dimensions, everything should be fine.

         And are they? You don't demonstrate that you've checked for that

I did a simple print px.shape, rain.shape, etc. to check.  They are
all size (135,).



  Apparently that is not the case?  If 1D arrays are not allowed in
  contourf, then how can I change my data into a 2D array?

         Also note (jumping to your follow up) that contourf is described as
 having a potential problem with masked arrays (whatever those are) for
 Z


My problem isn't with the masked arrays as much as it is with rain
being a 1D array.  IDL can handle contouring 1D arrays with missing
variables lickety-split, so I was really hoping Python could as well.

Also, numpy.ma is the masked array library.  See
http://docs.scipy.org/doc/numpy/reference/routines.ma.html.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: bug? pkgutil.walk_packages returns packages that result in an ImportError

2010-08-26 Thread Peter Otten
Chris Withers wrote:

  From the docs of pkgutils.walk_packages:
 
  'onerror' is a function which gets called with one argument (the
  name of the package which was being imported) if any exception
  occurs while trying to import a package.  If no onerror function is
  supplied, ImportErrors are caught and ignored, while all other
  exceptions are propagated, terminating the search.
 
 
 My expectation of this is that if onerrors is left as None, names
 yielded will be importable.

I would infer no such promise, especially as the generator also yields 
modules, and no attempt at all is made to import those.
 
 However, because the yield is before the import check, you can get
 packages returned that are not importable.
 
 This feels at odds with the docs above and I think is a bug.
 
 If the yield were dropped to befoer the import check, we wouldn't have
 this problem.
 
 what do others think?

I've never worked with that function; I'd like to hear more about your 
usecase.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Iterative vs. Recursive coding

2010-08-26 Thread John Bokma
Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid writes:

 BartC a écrit :
 Steven D'Aprano st...@remove-this-cybersource.com.au wrote in
 message news:4c6f8edd$0$28653$c3e8...@news.astraweb.com...
 On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:

 I onced worked in a shop (Win32 desktop / accouting applications mainly)
 where I was the only guy that could actually understand recursion. FWIW,
 I also was the only guy around that understood hairy (lol) concepts
 like callback functions, FSM, polymorphism, hashtables, linked lists,
 ADTs, algorithm complexity etc...


 Was there anything they *did* understand, or did they just bang on the
 keyboard at random until the code compiled? *wink*

 You underestimate how much programming (of applications) can be done
 without needing any of this stuff.

 From personal experience : almost nothing worth being maintained. I'm
 talking about complex domain-specific applications here - not shell
 scripts or todo-lists.

I doubt anyone who codes like that keeps a todo-list.

 Needless to say, I didn't last long !-)

 And rightly so :)

 I guess they wanted code that could be maintained by anybody.

 The code base was an unmaintainable, undecipĥerable mess loaded with
 global state (litteraly *hundreds* of global variables), duplication,
 dead code, and enough WTF to supply thedailywtf.com for years - to
 make a long story short, the perfect BigBallOfMudd. FWIW, the company
 didn't last long neither - they just kept on introducing ten new bugs
 each time they fixed one.

and they forgot to sell that as new features, I guess :-D.

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Path / Listing and os.walk problem.

2010-08-26 Thread Alban Nona
Hey ! Thank you guys !
It help me a lot !

@Dennis (Gomes): Thanks ! I tried it it worked well but list me the whole
files :P (and finally crashed python...lol)

I looked at the Peter method and, Im really dumb to didnt tough about
defining a pattern like *_v001.0001.exr * like this, it sort me only one
frame...which is perfect and less memory consuming I guess.

And glob use seems to be perfect for what I want to do ! so thank you to
point me in this direction :p

I tried also the Peter code, and it give me a good listing of my element
like I wanted:

HPO7_SEQ004_031_VDMRoom_ALB
HPO7_SEQ004_031_VDMRoom_AMB
HPO7_SEQ004_031_VDMRoom_BTY
HPO7_SEQ004_031_VDMRoom_Cutouts_ALB
HPO7_SEQ004_031_VDMRoom_Cutouts_AMB
HPO7_SEQ004_031_VDMRoom_Cutouts_DET

HPO7_SEQ004_031_VDMRoom_DET
HPO7_SEQ004_031_VDMRoom_DIF
HPO7_SEQ004_031_VDMRoom_DPF
HPO7_SEQ004_031_VDMRoom_Decals_ALB

HPO7_SEQ004_031_VDM_ALB
HPO7_SEQ004_031_VDM_AMB
HPO7_SEQ004_031_VDM_BTY
HPO7_SEQ004_031_VDM_DIF
HPO7_SEQ004_031_VDM_DPF
HPO7_SEQ004_031_VDM_Fresnel_mat


Unfortunatly, a new problem come to me, I looking to get that kind of  list:

HPO7_SEQ004_031_VDMRoom
HPO7_SEQ004_031_VDMRoom
HPO7_SEQ004_031_VDMRoom
HPO7_SEQ004_031_VDMRoom_Cutouts
HPO7_SEQ004_031_VDMRoom_Cutouts
HPO7_SEQ004_031_VDMRoom_Cutouts


Right now, Im looking the documentation to find a way to do it, Im thinking
about string methods, I also though:  hey, I just have to delete the 4 last
characters, but na ! itll not work because sometime I have something like
_Fresnel_mat'' which is of course more than 4 chars...)

Maybe the best would be to declare something like in the string, look at
the last _ and delete it + whatever there is after
but I didnt find how to do it, I mean I tried splitext which is, not
appropriate.

Do I have to declare a list of element like:
elementList: [_ALB, AMB, _Beauty, etc...]
and to search that pattern in the files name to remove it after ? it seems
not bad as solution, but I pretty sure there is a better way to do it.

right ?

anyway, thank very much guys ! :)
and have a good day !


2010/8/26 Peter Otten __pete...@web.de

 Alban Nona wrote:

  Hi
 
  So here is my problem:
 
  I have my render files that are into a directory like this:
 
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0001.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0002.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0003.exr
  
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0001.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0002.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0003.exr
 
  True is, there is like 1000 Files is the directory (C:\log\renderfiles\)
 
  What Iam looking to is to extract the first part of the filenames as a
  list, but I dont want the script to extract it 1000times, I mean I dont
  need it to extract HPO7_SEQ004_031_VDM_AMB 150 times, because there is
 150
  Frames. (not sure if its clear tought)
 
  so far, I would like the list to look lik:
 
  [HPO7_SEQ004_031_VDM_DIF, HPO7_SEQ004_031_VDM_AMB, etc...]
 
 
  I start to think about that, to try to use a
 
  for (path, dirs, files) in os.walk(path):
  list.append(files)
 
 
  but this kind of thing will just append the whole 1000 files, thing that
 I
  dont want, and more complicated I dont want the thing after AMB or
 DIF
  in the name files to follow.
  (thing I can delete using a split, if I read well ?)
 
 
  I trying to search on internet for answer, but seems I find nothing about
  it.
  Someone can help me with that please, show me the way or something ?

 You can use glob. Assuming the files are all in one directory:

 import os
 import glob

 folder = rC:\log\renderfiles

 # find files that end with _V001.0001.exr
 pattern = os.path.join(folder, *_V001.0001.exr)
 files = glob.glob(pattern)

 # remove the directory
 names = [os.path.basename(f) for f in files]

 # remove everything after and including the last occurence of _
 names = [n.rpartition(_)[0] for n in names]

 print \n.join(sorted(names))

 Peter

 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Webcam support

2010-08-26 Thread garabik-news-2005-05
Navkirat Singh navkir...@gmail.com wrote:
 Hi Guys,
 
 I am programming a web centric app in python for customer, which needs
 to click a snap of the customer and forward the pic to the server via
 POST. I am not very familiar with how I can achieve this. Any
 direction would be much appreciated.


For something very similar, I used fswebcam, the crucial code looked
like this:

def capture_frame(filename, brightness=50): 
 
os.system('fswebcam -S 1 -r %s -s brightness=%i%% 
   --font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf 
   --jpeg 60 --save %s' % (RESOLUTION, brightness, filename))
 

-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread
-- 
http://mail.python.org/mailman/listinfo/python-list


Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
Hey guys,

I am programming a webserver, I receive a jpeg file with the POST method.The 
file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a 
string. I wanted to know how i could write the file (now a string) as a jpeg 
image on disk. When I try to encode the same string to a bytes and write them 
in binary format to disk, the file is not recognized as jpeg. I would be 
grateful if someone could help me with this.


Regards,
Nav 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Webcam support

2010-08-26 Thread Navkirat Singh

On 26-Aug-2010, at 9:49 PM, garabik-news-2005...@kassiopeia.juls.savba.sk wrote:

 Navkirat Singh navkir...@gmail.com wrote:
 Hi Guys,
 
 I am programming a web centric app in python for customer, which needs
 to click a snap of the customer and forward the pic to the server via
 POST. I am not very familiar with how I can achieve this. Any
 direction would be much appreciated.
 
 
 For something very similar, I used fswebcam, the crucial code looked
 like this:
 
 def capture_frame(filename, brightness=50):   

os.system('fswebcam -S 1 -r %s -s brightness=%i%% 
   --font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf 
   --jpeg 60 --save %s' % (RESOLUTION, brightness, filename))
 
 
 -- 
 ---
 | Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
 | __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
 Antivirus alert: file .signature infected by signature virus.
 Hi! I'm a signature virus! Copy me into your signature file to help me spread
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Thanks guys, I stumbled upon jpegcam (javascript and flash library) which does 
this. It works awesome !! :)

Regards
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread John Bokma
Navkirat Singh navkir...@gmail.com writes:

 Hey guys,

 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string.

Why?

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 26-Aug-2010, at 11:01 PM, John Bokma wrote:

 Navkirat Singh navkir...@gmail.com writes:
 
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string.
 
 Why?
 
 -- 
 John Bokma   j3b
 
 Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
 -- 
 http://mail.python.org/mailman/listinfo/python-list

why? I am not quite sure what you have not understood.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Grant Edwards
On 2010-08-26, Navkirat Singh navkir...@gmail.com wrote:

 On 26-Aug-2010, at 11:01 PM, John Bokma wrote:

 Navkirat Singh navkir...@gmail.com writes:
 
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string.
 
 Why?

 why? I am not quite sure what you have not understood.

You're starting with JPEG data.  If you want to write it to a file,
then write it to a file.

Whatever process you're describing as I parse the bytes by decoding
them to a string is not needed and is apparently converting the JPEG
data into something that's not JPEG data.

-- 
Grant Edwards   grant.b.edwardsYow! PARDON me, am I
  at   speaking ENGLISH?
  gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Stefan Schwarzer
Hi Navkirat,

On 2010-08-26 19:22, Navkirat Singh wrote:
 I am programming a webserver, I receive a jpeg file with
 the POST method.The file (.jpeg) is encoded in bytes, I
 parse the bytes by decoding them to a string. I wanted to
 know how i could write the file (now a string) as a jpeg
 image on disk. When I try to encode the same string to a
 bytes and write them in binary format to disk, the file is
 not recognized as jpeg. I would be grateful if someone
 could help me with this.

I guess you mean you see a byte string in your server and
want to write that to disk. Assuming the string you got is
the correct image data in the first place, you can, in
Python 2.x, write the string data to disk like this:

fobj = open(some_image.jpg, wb)
fobj.write(byte_string)
fobj.close()

Note that you should use wb as mode to write as binary.
Otherwise you'll get automatic line ending conversion (at
least on Windows) which will give the result you describe.

If my answer doesn't help, you probably need to describe in
more detail what you're doing, including showing some real
code.

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Path / Listing and os.walk problem.

2010-08-26 Thread Alban Nona
So I found a way to do it, maybe some people could be interested:

listNames = []
for n in names:
listNames.append('_'.join(n.split('_')[:-1]))
#It will cut the last part of the file name convention

listNames = list(set(listNames)) #we Delete duplicates from the list, like
this we only have what we are interested in
for e in listNames: #Juste to check.
print e

:)



2010/8/26 Alban Nona python.k...@gmail.com

 Hey ! Thank you guys !
 It help me a lot !

 @Dennis (Gomes): Thanks ! I tried it it worked well but list me the whole
 files :P (and finally crashed python...lol)

 I looked at the Peter method and, Im really dumb to didnt tough about
 defining a pattern like *_v001.0001.exr * like this, it sort me only one
 frame...which is perfect and less memory consuming I guess.

 And glob use seems to be perfect for what I want to do ! so thank you to
 point me in this direction :p

 I tried also the Peter code, and it give me a good listing of my element
 like I wanted:

 HPO7_SEQ004_031_VDMRoom_ALB
 HPO7_SEQ004_031_VDMRoom_AMB
 HPO7_SEQ004_031_VDMRoom_BTY
 HPO7_SEQ004_031_VDMRoom_Cutouts_ALB
 HPO7_SEQ004_031_VDMRoom_Cutouts_AMB
 HPO7_SEQ004_031_VDMRoom_Cutouts_DET
 
 HPO7_SEQ004_031_VDMRoom_DET
 HPO7_SEQ004_031_VDMRoom_DIF
 HPO7_SEQ004_031_VDMRoom_DPF
 HPO7_SEQ004_031_VDMRoom_Decals_ALB
 
 HPO7_SEQ004_031_VDM_ALB

 HPO7_SEQ004_031_VDM_AMB
 HPO7_SEQ004_031_VDM_BTY

 HPO7_SEQ004_031_VDM_DIF
 HPO7_SEQ004_031_VDM_DPF
 HPO7_SEQ004_031_VDM_Fresnel_mat


 Unfortunatly, a new problem come to me, I looking to get that kind of
 list:

 HPO7_SEQ004_031_VDMRoom
 HPO7_SEQ004_031_VDMRoom
 HPO7_SEQ004_031_VDMRoom
 HPO7_SEQ004_031_VDMRoom_Cutouts
 HPO7_SEQ004_031_VDMRoom_Cutouts
 HPO7_SEQ004_031_VDMRoom_Cutouts
 

 Right now, Im looking the documentation to find a way to do it, Im thinking
 about string methods, I also though:  hey, I just have to delete the 4 last
 characters, but na ! itll not work because sometime I have something like
 _Fresnel_mat'' which is of course more than 4 chars...)

 Maybe the best would be to declare something like in the string, look at
 the last _ and delete it + whatever there is after
 but I didnt find how to do it, I mean I tried splitext which is, not
 appropriate.

 Do I have to declare a list of element like:
 elementList: [_ALB, AMB, _Beauty, etc...]
 and to search that pattern in the files name to remove it after ? it seems
 not bad as solution, but I pretty sure there is a better way to do it.

 right ?

 anyway, thank very much guys ! :)
 and have a good day !


 2010/8/26 Peter Otten __pete...@web.de

 Alban Nona wrote:

  Hi
 
  So here is my problem:
 
  I have my render files that are into a directory like this:
 
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0001.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0002.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_DIF_V001.0003.exr
  
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0001.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0002.exr
  c:\log\renderfiles\HPO7_SEQ004_031_VDM_AMB_V001.0003.exr
 
  True is, there is like 1000 Files is the directory (C:\log\renderfiles\)
 
  What Iam looking to is to extract the first part of the filenames as a
  list, but I dont want the script to extract it 1000times, I mean I dont
  need it to extract HPO7_SEQ004_031_VDM_AMB 150 times, because there is
 150
  Frames. (not sure if its clear tought)
 
  so far, I would like the list to look lik:
 
  [HPO7_SEQ004_031_VDM_DIF, HPO7_SEQ004_031_VDM_AMB, etc...]
 
 
  I start to think about that, to try to use a
 
  for (path, dirs, files) in os.walk(path):
  list.append(files)
 
 
  but this kind of thing will just append the whole 1000 files, thing that
 I
  dont want, and more complicated I dont want the thing after AMB or
 DIF
  in the name files to follow.
  (thing I can delete using a split, if I read well ?)
 
 
  I trying to search on internet for answer, but seems I find nothing
 about
  it.
  Someone can help me with that please, show me the way or something ?

 You can use glob. Assuming the files are all in one directory:

 import os
 import glob

 folder = rC:\log\renderfiles

 # find files that end with _V001.0001.exr
 pattern = os.path.join(folder, *_V001.0001.exr)
 files = glob.glob(pattern)

 # remove the directory
 names = [os.path.basename(f) for f in files]

 # remove everything after and including the last occurence of _
 names = [n.rpartition(_)[0] for n in names]

 print \n.join(sorted(names))

 Peter

 --
 http://mail.python.org/mailman/listinfo/python-list



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh
I am sorry, maybe I was not elaborate in what I was having trouble with. I am 
using a jpegcam library, which on my web page captures a webcam image and sends 
it to the server via the POST method. On the Server side (python 3), I receive 
this image as a part of header content in bytes (I know thats not how it should 
be done, but the author has some reason for it), so I first convert the headers 
to a string so I can separate them. From the separated headers I fish out the 
content of the image file (which is a string). This is where I get stuck, how 
am I supposed to convert it back to an image, so I can save as a jpeg on disk.

Regards,
Nav

On 27-Aug-2010, at 12:07 AM, Stefan Schwarzer wrote:

 Hi Navkirat,
 
 On 2010-08-26 19:22, Navkirat Singh wrote:
 I am programming a webserver, I receive a jpeg file with
 the POST method.The file (.jpeg) is encoded in bytes, I
 parse the bytes by decoding them to a string. I wanted to
 know how i could write the file (now a string) as a jpeg
 image on disk. When I try to encode the same string to a
 bytes and write them in binary format to disk, the file is
 not recognized as jpeg. I would be grateful if someone
 could help me with this.
 
 I guess you mean you see a byte string in your server and
 want to write that to disk. Assuming the string you got is
 the correct image data in the first place, you can, in
 Python 2.x, write the string data to disk like this:
 
fobj = open(some_image.jpg, wb)
fobj.write(byte_string)
fobj.close()
 
 Note that you should use wb as mode to write as binary.
 Otherwise you'll get automatic line ending conversion (at
 least on Windows) which will give the result you describe.
 
 If my answer doesn't help, you probably need to describe in
 more detail what you're doing, including showing some real
 code.
 
 Stefan
 -- 
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread MRAB

On 26/08/2010 19:57, Navkirat Singh wrote:

I am sorry, maybe I was not elaborate in what I was having trouble
with. I am using a jpegcam library, which on my web page captures a
webcam image and sends it to the server via the POST method. On the
Server side (python 3), I receive this image as a part of header
content in bytes (I know thats not how it should be done, but the
author has some reason for it), so I first convert the headers to a
string so I can separate them. From the separated headers I fish out
the content of the image file (which is a string). This is where I
get stuck, how am I supposed to convert it back to an image, so I can
save as a jpeg on disk.


[snip]
What does that string look like? Try printing out repr(image[ : 100]).
If it looks like plain bytes, then write it to file. If it looks like a
series of hex digits, then decode to bytes before writing.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Overload print

2010-08-26 Thread John Roth
On Aug 25, 3:42 pm, Alexander Kapps alex.ka...@web.de wrote:
 Ross Williamson wrote:
  Hi All

  Is there anyway in a class to overload the print function?

 In Python = 2.x print is a statement and thus can't be
 overloaded. That's exactly the reason, why Python 3 has turned
 print into a function.

  class foo_class():
      def __print__(self):
            print hello

  cc = foo_class()
  print cc

  Gives:

  hello

 Hmm, on what Python version are you? To my knowledge there is no
 __print__ special method. Did you mean __str__ or __repr__ ?

  I'm looking at finding nice way to print variables in a class just by
  asking to print it

 In Python3 you *can* overload print(), but still, you better define
 __str__() on your class to return a string, representing what ever
 you want:

 In [11]: class Foo(object):
     :     def __str__(self):
     :         return foo
     :
     :

 In [12]: f = Foo()

 In [13]: print f
 foo

Maybe what the OP really wants is the format() method on a string?
That gives a very rich set of override options, at the expense of not
using the print statement/method, including the ability to define your
own formatting language for a class.

John Roth
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CRIMINAL YanQui MARINES Cesar Laurean Regularly RAPE GIRLS Maria Lauterbach and KILL THEM - CIA/Mossad/Jew did 911 - Wikileaks for ever CRIMES of YANQUI Bustards

2010-08-26 Thread Simon Brooke
On Wed, 25 Aug 2010 07:31:03 -0700, Standish P wrote:

 ... so you want to render this in TeX ... ?

It was very thoughtful of you to repost the whole spammer text for the 
benefit of those of us who have the spammer killfiled, and consequently 
would not otherwise have been able to read it.

-- 

;; Semper in faecibus sumus, sole profundam variat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Robert Kern

On 8/26/10 1:25 PM, Navkirat Singh wrote:


On 26-Aug-2010, at 11:01 PM, John Bokma wrote:


Navkirat Singhnavkir...@gmail.com  writes:


Hey guys,

I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string.


Why?

--
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
--
http://mail.python.org/mailman/listinfo/python-list


why? I am not quite sure what you have not understood.


Why decode the bytes to (presumably) unicode strings just to encode them back to 
bytes again? JPEG is not composed of unicode characters; you need to leave them 
as bytes.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 1:10 AM, Robert Kern wrote:

 On 8/26/10 1:25 PM, Navkirat Singh wrote:
 
 On 26-Aug-2010, at 11:01 PM, John Bokma wrote:
 
 Navkirat Singhnavkir...@gmail.com  writes:
 
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string.
 
 Why?
 
 --
 John Bokma   j3b
 
 Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 why? I am not quite sure what you have not understood.
 
 Why decode the bytes to (presumably) unicode strings just to encode them back 
 to bytes again? JPEG is not composed of unicode characters; you need to leave 
 them as bytes.
 
 -- 
 Robert Kern
 
 I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

The image bytes are a part of a HTTP header content ( not the message body ). 
To separate the header content from the image I have to first convert the bytes 
to string to perform parsing. The resultant string then needs to be converted 
back to the image. Hence, my problem.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 12:45 AM, MRAB wrote:

 On 26/08/2010 19:57, Navkirat Singh wrote:
 I am sorry, maybe I was not elaborate in what I was having trouble
 with. I am using a jpegcam library, which on my web page captures a
 webcam image and sends it to the server via the POST method. On the
 Server side (python 3), I receive this image as a part of header
 content in bytes (I know thats not how it should be done, but the
 author has some reason for it), so I first convert the headers to a
 string so I can separate them. From the separated headers I fish out
 the content of the image file (which is a string). This is where I
 get stuck, how am I supposed to convert it back to an image, so I can
 save as a jpeg on disk.
 
 [snip]
 What does that string look like? Try printing out repr(image[ : 100]).
 If it looks like plain bytes, then write it to file. If it looks like a
 series of hex digits, then decode to bytes before writing.
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Thanks MRAB, your suggestions have always been very helpful to me. I shall let 
you know on what I see.

Regards,
Nav
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Dave Angel

Navkirat Singh wrote:

Hey guys,

I am programming a webserver, I receive a jpeg file with the POST method.The 
file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a 
string. I wanted to know how i could write the file (now a string) as a jpeg 
image on disk. When I try to encode the same string to a bytes and write them 
in binary format to disk, the file is not recognized as jpeg. I would be 
grateful if someone could help me with this.


Regards,
Nav 
  
If by decoding them to a string you mean converting to Unicode, then 
you've already trashed the data.  That's only valid if the bytes had 
been encoded from valid Unicode characters, and then only if you use the 
corresponding decoding technique.


If you mean some other decoding, then the question is meaningless 
without telling us just what the decoding is, preferably with some code.


It also might be useful to know what version of Python you're using, 
when you post the code.


DaveA

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:

 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST method.The 
 file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a 
 string. I wanted to know how i could write the file (now a string) as a jpeg 
 image on disk. When I try to encode the same string to a bytes and write 
 them in binary format to disk, the file is not recognized as jpeg. I would 
 be grateful if someone could help me with this.
 
 
 Regards,
 Nav   
 If by decoding them to a string you mean converting to Unicode, then you've 
 already trashed the data.  That's only valid if the bytes had been encoded 
 from valid Unicode characters, and then only if you use the corresponding 
 decoding technique.
 
 If you mean some other decoding, then the question is meaningless without 
 telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using, when you 
 post the code.
 
 DaveA
 

Dave,

I am using Python3 and I receive a byte stream with a jpeg attached sent by the 
web browser over a socket, which looks like this:

b': image/jpeg\r\nAccept: text/*\r\nReferer: 
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, 
deflate\r\nContent-Length: 91783\r\nConnection: 
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

From the above, I need to:

a) Split the header content from the image content, which comes after the 
keep-alive\r\n\r\n part

b) Then write the image content to file for further use as a jpeg.

Nav-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:

 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST method.The 
 file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a 
 string. I wanted to know how i could write the file (now a string) as a jpeg 
 image on disk. When I try to encode the same string to a bytes and write 
 them in binary format to disk, the file is not recognized as jpeg. I would 
 be grateful if someone could help me with this.
 
 
 Regards,
 Nav   
 If by decoding them to a string you mean converting to Unicode, then you've 
 already trashed the data.  That's only valid if the bytes had been encoded 
 from valid Unicode characters, and then only if you use the corresponding 
 decoding technique.
 
 If you mean some other decoding, then the question is meaningless without 
 telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using, when you 
 post the code.
 
 DaveA
 

Also, my apologies for lack of knowledge of character encodings. You have 
pointed out correctly about  unicode encoding. I was under the impression that 
a unicode will preserve the integrity of the message which has been encoded. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: matplotlib pyplot contourf with 1-D array (vector)

2010-08-26 Thread becky_s
I was able to figure this out on my own.  First, to eliminate the
masked arrays, I used a combination of the where and compress
functions to remove any missing data from my 1-D arrays.  Then, I used
the griddata function as described above.  This did the trick.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread MRAB

On 26/08/2010 21:14, Navkirat Singh wrote:


On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:


Navkirat Singh wrote:

Hey guys,

I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string. I wanted to know how i could write the
file (now a string) as a jpeg image on disk. When I try to encode the
same string to a bytes and write them in binary format to disk, the
file is not recognized as jpeg. I would be grateful if someone could
help me with this.


Regards,
Nav

If by decoding them to a string you mean converting to Unicode, then
you've already trashed the data. That's only valid if the bytes had
been encoded from valid Unicode characters, and then only if you use
the corresponding decoding technique.

If you mean some other decoding, then the question is meaningless
without telling us just what the decoding is, preferably with some code.

It also might be useful to know what version of Python you're using,
when you post the code.

DaveA



Dave,

I am using Python3 and I receive a byte stream with a jpeg attached sent
by the web browser over a socket, which looks like this:

b': image/jpeg\r\nAccept: text/*\r\nReferer:
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
gzip, deflate\r\nContent-Length: 91783\r\nConnection:
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

 From the above, I need to:

a) Split the header content from the image content, which comes after
the keep-alive\r\n\r\n part

b) Then write the image content to file for further use as a jpeg.


Try:

image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Dave Angel

Navkirat Singh wrote:

O
snip
I am using Python3 and I receive a byte stream with a jpeg attached sent by the 
web browser over a socket, which looks like this:

b': image/jpeg\r\nAccept: text/*\r\nReferer: 
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, 
deflate\r\nContent-Length: 91783\r\nConnection: 
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

From the above, I need to:

a) Split the header content from the image content, which comes after the 
keep-alive\r\n\r\n part

b) Then write the image content to file for further use as a jpeg.

Nav
  
An arbitrary string of bytes is not necessarily valid utf-8, so I'm not 
sure why you haven't been getting errors during that decode.  In any 
case, such a conversion is not reversible.


I would parse that as bytes, perhaps by searching for 'keep-alive'.  
Then split the byte stream into the two parts, and only convert the 
first part to Unicode (Python 3 string).  For safety, you could check to 
make sure the search pattern only appears once, and potentially decode 
it multiple times.  It'll only make sense once.


DaveA

--
http://mail.python.org/mailman/listinfo/python-list


Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-26 Thread Brad
On Aug 25, 4:05 am, Alex McDonald b...@rivadpm.com wrote:
 Your example of writing code with
 memory leaks *and not caring because it's a waste of your time* makes
 me think that you've never been a programmer of any sort.

Windows applications are immune from memory leaks since programmers
can count on regular crashes to automatically release previously
allocated RAM.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 1:57 AM, MRAB wrote:

 On 26/08/2010 21:14, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
 
 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string. I wanted to know how i could write the
 file (now a string) as a jpeg image on disk. When I try to encode the
 same string to a bytes and write them in binary format to disk, the
 file is not recognized as jpeg. I would be grateful if someone could
 help me with this.
 
 
 Regards,
 Nav
 If by decoding them to a string you mean converting to Unicode, then
 you've already trashed the data. That's only valid if the bytes had
 been encoded from valid Unicode characters, and then only if you use
 the corresponding decoding technique.
 
 If you mean some other decoding, then the question is meaningless
 without telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using,
 when you post the code.
 
 DaveA
 
 
 Dave,
 
 I am using Python3 and I receive a byte stream with a jpeg attached sent
 by the web browser over a socket, which looks like this:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer:
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
 gzip, deflate\r\nContent-Length: 91783\r\nConnection:
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f
 
 From the above, I need to:
 
 a) Split the header content from the image content, which comes after
 the keep-alive\r\n\r\n part
 
 b) Then write the image content to file for further use as a jpeg.
 
 Try:
 
image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
 -- 
 http://mail.python.org/mailman/listinfo/python-list

I think I forgot to mention that the original is a stream of bytes decoded 
using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again). 

@MRAB - the split() method in python 3 works only on strings and throws an 
error if I try to use bytes






-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 2:14 AM, Brad wrote:

 On Aug 25, 4:05 am, Alex McDonald b...@rivadpm.com wrote:
 Your example of writing code with
 memory leaks *and not caring because it's a waste of your time* makes
 me think that you've never been a programmer of any sort.
 
 Windows applications are immune from memory leaks since programmers
 can count on regular crashes to automatically release previously
 allocated RAM.
 -- 
 http://mail.python.org/mailman/listinfo/python-list


Sorry if I may sound rude, but I have to do this on the windows applications 
comment - hahahahaha
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread John Bokma
Navkirat Singh navkir...@gmail.com writes:

 I am using Python3 and I receive a byte stream with a jpeg attached sent
 by the web browser over a socket, which looks like this:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer:
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
 gzip, deflate\r\nContent-Length: 91783\r\nConnection:
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

You're mistaken that the content is part of the headers, it's not. The
\r\n\r\n separates headers from the content.

Why don't you use urllib to save you from all this hassle?

-- 
John Bokma   j3b

Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl  Python Development: http://castleamber.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Robert Kern

On 8/26/10 3:47 PM, Navkirat Singh wrote:


On 27-Aug-2010, at 1:57 AM, MRAB wrote:


On 26/08/2010 21:14, Navkirat Singh wrote:


On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:


Navkirat Singh wrote:

Hey guys,

I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string. I wanted to know how i could write the
file (now a string) as a jpeg image on disk. When I try to encode the
same string to a bytes and write them in binary format to disk, the
file is not recognized as jpeg. I would be grateful if someone could
help me with this.


Regards,
Nav

If by decoding them to a string you mean converting to Unicode, then
you've already trashed the data. That's only valid if the bytes had
been encoded from valid Unicode characters, and then only if you use
the corresponding decoding technique.

If you mean some other decoding, then the question is meaningless
without telling us just what the decoding is, preferably with some code.

It also might be useful to know what version of Python you're using,
when you post the code.

DaveA



Dave,

I am using Python3 and I receive a byte stream with a jpeg attached sent
by the web browser over a socket, which looks like this:

b': image/jpeg\r\nAccept: text/*\r\nReferer:
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
gzip, deflate\r\nContent-Length: 91783\r\nConnection:
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

 From the above, I need to:

a) Split the header content from the image content, which comes after
the keep-alive\r\n\r\n part

b) Then write the image content to file for further use as a jpeg.


Try:

image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
--
http://mail.python.org/mailman/listinfo/python-list


I think I forgot to mention that the original is a stream of bytes decoded 
using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again).

@MRAB - the split() method in python 3 works only on strings and throws an 
error if I try to use bytes


This is incorrect.

Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type help, copyright, credits or license for more information.

 bytes = b'Connection: keep-alive\r\n\r\nbody'
 bytes.split(b'\r\n\r\n', 1)[-1]
b'body'


FYI: the JPEG data is not in the header. The b'\r\n\r\n' sequence delimits the 
header from the body. Do not rely on Connection: keep-alive being the last header.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 1:57 AM, MRAB wrote:

 On 26/08/2010 21:14, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
 
 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string. I wanted to know how i could write the
 file (now a string) as a jpeg image on disk. When I try to encode the
 same string to a bytes and write them in binary format to disk, the
 file is not recognized as jpeg. I would be grateful if someone could
 help me with this.
 
 
 Regards,
 Nav
 If by decoding them to a string you mean converting to Unicode, then
 you've already trashed the data. That's only valid if the bytes had
 been encoded from valid Unicode characters, and then only if you use
 the corresponding decoding technique.
 
 If you mean some other decoding, then the question is meaningless
 without telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using,
 when you post the code.
 
 DaveA
 
 
 Dave,
 
 I am using Python3 and I receive a byte stream with a jpeg attached sent
 by the web browser over a socket, which looks like this:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer:
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
 gzip, deflate\r\nContent-Length: 91783\r\nConnection:
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f
 
 From the above, I need to:
 
 a) Split the header content from the image content, which comes after
 the keep-alive\r\n\r\n part
 
 b) Then write the image content to file for further use as a jpeg.
 
 Try:
 
image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
 -- 
 http://mail.python.org/mailman/listinfo/python-list


Yay !! I figured it outit was really very simple. And if I really feel 
guilty if I have wasted your time - @MRAB, @DAVE.

Here is what I needed to do:

a) Separate image content from header content of the byte stream received from 
the web browser.
b) Save the image content to disk for further use.

Here is what I did. Following is just a snippet:


#-HERE IS WHERE I RECEIVE THE DATA
while True:
buff = socket.recv(8192)
byteStr +=buff
if not buff: break
#--ENCODING/DECODING STARTS FROM HERE (since I want to use 
split/partition functions to separate header content from the image content)
strMsg = byteStr.decode(ISO-8859-1)
listMsg = strMsg.split('\r\n')
#
# do some more processing to search the list for the image content, say 
supposing index is 11
#---
imageStr = listMsg[11].encode(ISO-8859-1) #Transform the byte string 
just the way I found it

f = open('received.jpg','w'b)
f.write(imageStr)

The resultant file is a jpg file.


Thanks,
Nav










-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread MRAB

On 26/08/2010 21:47, Navkirat Singh wrote:


On 27-Aug-2010, at 1:57 AM, MRAB wrote:


On 26/08/2010 21:14, Navkirat Singh wrote:


On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:


Navkirat Singh wrote:

Hey guys,

I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string. I wanted to know how i could write the
file (now a string) as a jpeg image on disk. When I try to encode the
same string to a bytes and write them in binary format to disk, the
file is not recognized as jpeg. I would be grateful if someone could
help me with this.


Regards,
Nav

If by decoding them to a string you mean converting to Unicode, then
you've already trashed the data. That's only valid if the bytes had
been encoded from valid Unicode characters, and then only if you use
the corresponding decoding technique.

If you mean some other decoding, then the question is meaningless
without telling us just what the decoding is, preferably with some code.

It also might be useful to know what version of Python you're using,
when you post the code.

DaveA



Dave,

I am using Python3 and I receive a byte stream with a jpeg attached sent
by the web browser over a socket, which looks like this:

b': image/jpeg\r\nAccept: text/*\r\nReferer:
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
gzip, deflate\r\nContent-Length: 91783\r\nConnection:
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

 From the above, I need to:

a) Split the header content from the image content, which comes after
the keep-alive\r\n\r\n part

b) Then write the image content to file for further use as a jpeg.


Try:

image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
--
http://mail.python.org/mailman/listinfo/python-list


I think I forgot to mention that the original is a stream of bytes decoded 
using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again).

@MRAB - the split() method in python 3 works only on strings and throws an 
error if I try to use bytes


All i can say is that it works for me:

 header = b': image/jpeg\r\nAccept: text/*\r\nReferer: 
http://127.0.0.1:8001/\r\nAccept-Language:  en-us\r\nAccept-Encoding: 
gzip, deflate\r\nContent-Length: 91783\r\nConnection: 
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'

 image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
 image
b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'

What error did you get?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 2:40 AM, Robert Kern wrote:

 On 8/26/10 3:47 PM, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:57 AM, MRAB wrote:
 
 On 26/08/2010 21:14, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
 
 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string. I wanted to know how i could write the
 file (now a string) as a jpeg image on disk. When I try to encode the
 same string to a bytes and write them in binary format to disk, the
 file is not recognized as jpeg. I would be grateful if someone could
 help me with this.
 
 
 Regards,
 Nav
 If by decoding them to a string you mean converting to Unicode, then
 you've already trashed the data. That's only valid if the bytes had
 been encoded from valid Unicode characters, and then only if you use
 the corresponding decoding technique.
 
 If you mean some other decoding, then the question is meaningless
 without telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using,
 when you post the code.
 
 DaveA
 
 
 Dave,
 
 I am using Python3 and I receive a byte stream with a jpeg attached sent
 by the web browser over a socket, which looks like this:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer:
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
 gzip, deflate\r\nContent-Length: 91783\r\nConnection:
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f
 
 From the above, I need to:
 
 a) Split the header content from the image content, which comes after
 the keep-alive\r\n\r\n part
 
 b) Then write the image content to file for further use as a jpeg.
 
 Try:
 
image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 I think I forgot to mention that the original is a stream of bytes decoded 
 using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again).
 
 @MRAB - the split() method in python 3 works only on strings and throws an 
 error if I try to use bytes
 
 This is incorrect.
 
 Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18)
 [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
 Type help, copyright, credits or license for more information.
 
  bytes = b'Connection: keep-alive\r\n\r\nbody'
  bytes.split(b'\r\n\r\n', 1)[-1]
 b'body'
 
 
 FYI: the JPEG data is not in the header. The b'\r\n\r\n' sequence delimits 
 the header from the body. Do not rely on Connection: keep-alive being the 
 last header.
 
 -- 
 Robert Kern
 
 I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Thanks Everyone,

@Robert - Thanks a lot for your time :-) , I did know that the body starts 
after the occurrence two CRLF sequences, but I was following RFC2616 as a 
guide, which specifically mentions:

The presence of a message-body in a request is signaled by the 
inclusion of a
 Content-Length or Transfer- Encoding header field in the
  request’s message-headers

Which has not been done by the author of the library, hence I said what I did. 
Or I have misunderstood the RFC

Regards,
Nav





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 2:48 AM, MRAB wrote:

 On 26/08/2010 21:47, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:57 AM, MRAB wrote:
 
 On 26/08/2010 21:14, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
 
 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string. I wanted to know how i could write the
 file (now a string) as a jpeg image on disk. When I try to encode the
 same string to a bytes and write them in binary format to disk, the
 file is not recognized as jpeg. I would be grateful if someone could
 help me with this.
 
 
 Regards,
 Nav
 If by decoding them to a string you mean converting to Unicode, then
 you've already trashed the data. That's only valid if the bytes had
 been encoded from valid Unicode characters, and then only if you use
 the corresponding decoding technique.
 
 If you mean some other decoding, then the question is meaningless
 without telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using,
 when you post the code.
 
 DaveA
 
 
 Dave,
 
 I am using Python3 and I receive a byte stream with a jpeg attached sent
 by the web browser over a socket, which looks like this:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer:
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
 gzip, deflate\r\nContent-Length: 91783\r\nConnection:
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f
 
 From the above, I need to:
 
 a) Split the header content from the image content, which comes after
 the keep-alive\r\n\r\n part
 
 b) Then write the image content to file for further use as a jpeg.
 
 Try:
 
image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 I think I forgot to mention that the original is a stream of bytes decoded 
 using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again).
 
 @MRAB - the split() method in python 3 works only on strings and throws an 
 error if I try to use bytes
 
 All i can say is that it works for me:
 
  header = b': image/jpeg\r\nAccept: text/*\r\nReferer: 
  http://127.0.0.1:8001/\r\nAccept-Language:  en-us\r\nAccept-Encoding: 
  gzip, deflate\r\nContent-Length: 91783\r\nConnection: 
  keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'
  image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
  image
 b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'
 
 What error did you get?
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Hi MRAB,

Here is the error:

 b = b'asdf'
 type(b)
class 'bytes'
 s = b.split(':')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: Type str doesn't support the buffer API
 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Robert Kern

On 8/26/10 4:17 PM, Navkirat Singh wrote:


Here is what I needed to do:

a) Separate image content from header content of the byte stream received from 
the web browser.
b) Save the image content to disk for further use.

Here is what I did. Following is just a snippet:


#-HERE IS WHERE I RECEIVE THE DATA
while True:
buff = socket.recv(8192)
byteStr +=buff
if not buff: break
#--ENCODING/DECODING STARTS FROM HERE (since I want to use 
split/partition functions to separate header content from the image content)
strMsg = byteStr.decode(ISO-8859-1)
listMsg = strMsg.split('\r\n')
#
# do some more processing to search the list for the image content, say 
supposing index is 11
#---
imageStr = listMsg[11].encode(ISO-8859-1) #Transform the byte string 
just the way I found it


If your JPEG happens to contain the bytes \r\n, then this will not work. Please 
follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 argument to 
make sure that you do not split on spurious b'\r\n\r\n' sequences inside the 
JPEG body. Do not decode the bytes.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Robert Kern

On 8/26/10 4:25 PM, Navkirat Singh wrote:


@Robert - Thanks a lot for your time :-) , I did know that the body starts after
the occurrence two CRLF sequences, but I was following RFC2616 as a guide, which
specifically mentions:

The presence of a message-body in a request is signaled by the inclusion of a

Content-Length or Transfer- Encoding header field in the

request’s message-headers

Which has not been done by the author of the library, hence I said what I did.
Or I have misunderstood the RFC


It certainly looks like the data has a Content-length header:

b': image/jpeg\r\nAccept: text/*\r\nReferer: 
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, 
deflate\r\nContent-Length: 91783\r\n

...

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 2:58 AM, Navkirat Singh wrote:

 
 On 27-Aug-2010, at 2:48 AM, MRAB wrote:
 
 On 26/08/2010 21:47, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:57 AM, MRAB wrote:
 
 On 26/08/2010 21:14, Navkirat Singh wrote:
 
 On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:
 
 Navkirat Singh wrote:
 Hey guys,
 
 I am programming a webserver, I receive a jpeg file with the POST
 method.The file (.jpeg) is encoded in bytes, I parse the bytes by
 decoding them to a string. I wanted to know how i could write the
 file (now a string) as a jpeg image on disk. When I try to encode the
 same string to a bytes and write them in binary format to disk, the
 file is not recognized as jpeg. I would be grateful if someone could
 help me with this.
 
 
 Regards,
 Nav
 If by decoding them to a string you mean converting to Unicode, then
 you've already trashed the data. That's only valid if the bytes had
 been encoded from valid Unicode characters, and then only if you use
 the corresponding decoding technique.
 
 If you mean some other decoding, then the question is meaningless
 without telling us just what the decoding is, preferably with some code.
 
 It also might be useful to know what version of Python you're using,
 when you post the code.
 
 DaveA
 
 
 Dave,
 
 I am using Python3 and I receive a byte stream with a jpeg attached sent
 by the web browser over a socket, which looks like this:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer:
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
 gzip, deflate\r\nContent-Length: 91783\r\nConnection:
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f
 
 From the above, I need to:
 
 a) Split the header content from the image content, which comes after
 the keep-alive\r\n\r\n part
 
 b) Then write the image content to file for further use as a jpeg.
 
 Try:
 
   image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
   open(image_path, 'wb').write(image)
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 I think I forgot to mention that the original is a stream of bytes decoded 
 using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again).
 
 @MRAB - the split() method in python 3 works only on strings and throws an 
 error if I try to use bytes
 
 All i can say is that it works for me:
 
 header = b': image/jpeg\r\nAccept: text/*\r\nReferer: 
 http://127.0.0.1:8001/\r\nAccept-Language:  en-us\r\nAccept-Encoding: 
 gzip, deflate\r\nContent-Length: 91783\r\nConnection: 
 keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'
 image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
 image
 b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'
 
 What error did you get?
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
 Hi MRAB,
 
 Here is the error:
 
 b = b'asdf'
 type(b)
 class 'bytes'
 s = b.split(':')
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: Type str doesn't support the buffer API
 
 
 
I got your point 

The argument for the split I have give is a string, hence the error.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Robert Kern

On 8/26/10 4:28 PM, Navkirat Singh wrote:


On 27-Aug-2010, at 2:48 AM, MRAB wrote:


On 26/08/2010 21:47, Navkirat Singh wrote:


On 27-Aug-2010, at 1:57 AM, MRAB wrote:


On 26/08/2010 21:14, Navkirat Singh wrote:


On 27-Aug-2010, at 1:32 AM, Dave Angel wrote:


Navkirat Singh wrote:

Hey guys,

I am programming a webserver, I receive a jpeg file with the POST
method.The file (.jpeg) is encoded in bytes, I parse the bytes by
decoding them to a string. I wanted to know how i could write the
file (now a string) as a jpeg image on disk. When I try to encode the
same string to a bytes and write them in binary format to disk, the
file is not recognized as jpeg. I would be grateful if someone could
help me with this.


Regards,
Nav

If by decoding them to a string you mean converting to Unicode, then
you've already trashed the data. That's only valid if the bytes had
been encoded from valid Unicode characters, and then only if you use
the corresponding decoding technique.

If you mean some other decoding, then the question is meaningless
without telling us just what the decoding is, preferably with some code.

It also might be useful to know what version of Python you're using,
when you post the code.

DaveA



Dave,

I am using Python3 and I receive a byte stream with a jpeg attached sent
by the web browser over a socket, which looks like this:

b': image/jpeg\r\nAccept: text/*\r\nReferer:
http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding:
gzip, deflate\r\nContent-Length: 91783\r\nConnection:
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f

 From the above, I need to:

a) Split the header content from the image content, which comes after
the keep-alive\r\n\r\n part

b) Then write the image content to file for further use as a jpeg.


Try:

image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
open(image_path, 'wb').write(image)
--
http://mail.python.org/mailman/listinfo/python-list


I think I forgot to mention that the original is a stream of bytes decoded 
using ISO-8859-1 as utf-8 trhrew errors (lack of knowlegdge again).

@MRAB - the split() method in python 3 works only on strings and throws an 
error if I try to use bytes


All i can say is that it works for me:


header = b': image/jpeg\r\nAccept: text/*\r\nReferer: 
http://127.0.0.1:8001/\r\nAccept-Language:  en-us\r\nAccept-Encoding: gzip, 
deflate\r\nContent-Length: 91783\r\nConnection: 
keep-alive\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'
image = header.split(b'keep-alive\r\n\r\n', 1)[-1]
image

b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x84\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f'

What error did you get?
--
http://mail.python.org/mailman/listinfo/python-list


Hi MRAB,

Here is the error:


b = b'asdf'
type(b)

class 'bytes'

s = b.split(':')

Traceback (most recent call last):
   File stdin, line 1, inmodule
TypeError: Type str doesn't support the buffer API




Follow MRAB's example. You need to use a bytes object for the *argument*, too.

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 3:02 AM, Robert Kern wrote:

 On 8/26/10 4:17 PM, Navkirat Singh wrote:
 
 Here is what I needed to do:
 
 a) Separate image content from header content of the byte stream received 
 from the web browser.
 b) Save the image content to disk for further use.
 
 Here is what I did. Following is just a snippet:
 
  
  #-HERE IS WHERE I RECEIVE THE DATA
  while True:
  buff = socket.recv(8192)
  byteStr +=buff
  if not buff: break
  #--ENCODING/DECODING STARTS FROM HERE (since I want to use 
 split/partition functions to separate header content from the image content)
  strMsg = byteStr.decode(ISO-8859-1)
  listMsg = strMsg.split('\r\n')
  #
  # do some more processing to search the list for the image content, say 
 supposing index is 11
  #---
  imageStr = listMsg[11].encode(ISO-8859-1) #Transform the byte string 
 just the way I found it
 
 If your JPEG happens to contain the bytes \r\n, then this will not work. 
 Please follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 
 argument to make sure that you do not split on spurious b'\r\n\r\n' sequences 
 inside the JPEG body. Do not decode the bytes.
 
 -- 
 Robert Kern
 
 I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Thanks Robert,

My method worked too, I was able to do the above and save the jpeg flawlessly, 
but your method seems better as I will not have to take the extra step of 
encoding/decoding.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Robert Kern

On 8/26/10 4:17 PM, Navkirat Singh wrote:


#-HERE IS WHERE I RECEIVE THE DATA
while True:
buff = socket.recv(8192)
byteStr +=buff
if not buff: break


Also, you probably shouldn't bother writing an HTTP server using raw sockets. 
Use HTTPServer instead:


  http://docs.python.org/py3k/library/http.server.html

or better, wsgiref:

  http://docs.python.org/py3k/library/wsgiref.html

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 3:04 AM, Robert Kern wrote:

 On 8/26/10 4:25 PM, Navkirat Singh wrote:
 
 @Robert - Thanks a lot for your time :-) , I did know that the body starts 
 after
 the occurrence two CRLF sequences, but I was following RFC2616 as a guide, 
 which
 specifically mentions:
 
 The presence of a message-body in a request is signaled by the inclusion of 
 a
 
 Content-Length or Transfer- Encoding header field in the
 
 request’s message-headers
 
 Which has not been done by the author of the library, hence I said what I 
 did.
 Or I have misunderstood the RFC
 
 It certainly looks like the data has a Content-length header:
 
 b': image/jpeg\r\nAccept: text/*\r\nReferer: 
 http://127.0.0.1:8001/\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, 
 deflate\r\nContent-Length: 91783\r\n
 ...
 
 -- 
 Robert Kern
 
 I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Once again you opened my eyes, I think its been a tough night for me. Seeing 
too much and nothing at the same time.

Regards
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 3:15 AM, Robert Kern wrote:

 On 8/26/10 4:17 PM, Navkirat Singh wrote:
 
  #-HERE IS WHERE I RECEIVE THE DATA
  while True:
  buff = socket.recv(8192)
  byteStr +=buff
  if not buff: break
 
 Also, you probably shouldn't bother writing an HTTP server using raw sockets. 
 Use HTTPServer instead:
 
  http://docs.python.org/py3k/library/http.server.html
 
 or better, wsgiref:
 
  http://docs.python.org/py3k/library/wsgiref.html
 
 -- 
 Robert Kern
 
 I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list


Thanks a lot guys, you all have been a lot of help !!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Editor or IDE ActiveX control

2010-08-26 Thread Thomas Jollans
On Thursday 26 August 2010, it occurred to Sathish S to exclaim:
 Hi Ppl,
 
 Is there any python IDE or editor that has an ActiveX control which could
 be embed in other Windows applications. I'm basically looking to write a
 application that can show the indentations of python, change the color of
 keywords etc on a application, which will save this python script and run
 it from command prompt.

It sounds to me like you're just looking for any old halfway decent embeddable 
programmer's editor that happens to have syntax definitions for Python.

I'd suggest you have a look at Scintilla. Quite a good editing control, I 
don't think it comes wrapped in ActiveX or anything like that, just interface 
it in your favourite language using the DLL's C API.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Terry Reedy

On 8/26/2010 5:28 PM, Navkirat Singh wrote:


b = b'asdf'
type(b)

class 'bytes'

s = b.split(':')


You are trying to split bytes with a string, which is impossible.
Split bytes with bytes, strings with strings.


Traceback (most recent call last):
   File stdin, line 1, inmodule
TypeError: Type str doesn't support the buffer API



--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Navkirat Singh

On 27-Aug-2010, at 4:23 AM, Terry Reedy wrote:

 On 8/26/2010 5:28 PM, Navkirat Singh wrote:
 
 b = b'asdf'
 type(b)
 class 'bytes'
 s = b.split(':')
 
 You are trying to split bytes with a string, which is impossible.
 Split bytes with bytes, strings with strings.
 
 Traceback (most recent call last):
   File stdin, line 1, inmodule
 TypeError: Type str doesn't support the buffer API
 
 
 -- 
 Terry Jan Reedy
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

Thanks !
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Editor or IDE ActiveX control

2010-08-26 Thread Stef Mientki
 On 27-08-2010 00:22, Thomas Jollans wrote:
 On Thursday 26 August 2010, it occurred to Sathish S to exclaim:
 Hi Ppl,

 Is there any python IDE or editor that has an ActiveX control which could
 be embed in other Windows applications. I'm basically looking to write a
 application that can show the indentations of python, change the color of
 keywords etc on a application, which will save this python script and run
 it from command prompt.
 It sounds to me like you're just looking for any old halfway decent 
 embeddable 
 programmer's editor that happens to have syntax definitions for Python.

 I'd suggest you have a look at Scintilla. Quite a good editing control, I 
 don't think it comes wrapped in ActiveX or anything like that, just interface 
 it in your favourite language using the DLL's C API.
Scintilla is full embedded in wxPython.
cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyxser-1.5r --- Python Object to XML serializer/deserializer

2010-08-26 Thread Josh English


It looks nice, but it's a shame it doesn't work on Windows. This
could
solve a lot of the problems I'm running into in my own attempt to
build a python Class implementation of an XML Validation object.
-- 
http://mail.python.org/mailman/listinfo/python-list


Trouble importing cx_Oracle on HPUX

2010-08-26 Thread Cliff Martin
I have just gotten done building Python 3.1.2 on HPUX 11.31 Itanium
(IA64) using gcc 4.4.3, and have tried building cx_Oracle to go with
it. The build succeeds, but test and importing does not. I have tried
building Python with threads and without. The only exotic thing I do
with the configure for python is to supply -mlp64, which makes it a 64
bit build. Python 3 appears to work just fine, and cx_Oracle has
worked on this same architecture in the past with Python 2.6.5.

Help! I would really like to use Python 3, but Oracle support is a
requirement. Everything I've read indicates it should work, but there
is not a lot of people doing this or posting notes about their install
problems or successes on HP-UX.

Cliff
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyxser-1.5r --- Python Object to XML serializer/deserializer

2010-08-26 Thread Stefan Behnel

Josh English, 27.08.2010 01:30:

solve a lot of the problems I'm running into in my own attempt to
build a python Class implementation of an XML Validation object.


How would object serialisation help here?

Stefan

--
http://mail.python.org/mailman/listinfo/python-list


[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp

2010-08-26 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

I checked in a modified version of reset the retry count for respnse code !=401 
in the following checkins:
r84323 (py3k)
r84324 (release21-maint)
r84325 (release31-maint)

Unfortunately, we wont be able to patch the 2.6.x release. You might want to 
use patch which is attached or fix it at mercurial end.

Another issue, Issue9639 was fixed to reset the retry on successful response.

I am going to close this issue, there was a minor discussion in the middle if 5 
retries in worth it, but it looks like it is (msg107261).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8797
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp

2010-08-26 Thread Senthil Kumaran

Changes by Senthil Kumaran orsent...@gmail.com:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
Added file: http://bugs.python.org/file18648/basic_auth.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8797
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9690] Cannot distinguish bstr from str in ast module.

2010-08-26 Thread Kay Hayen

Kay Hayen kayha...@gmx.de added the comment:

You didn't understand. Please tell me, how to decide if this is a unicode 
literal or a str (2.x) literal:

value=Str(s='d')

It's just not possible. When I found a from __future__ import 
unicode_literals in the code before, it means I should convert value.s to 
unicode fine. But the syntax allows with bd to make an exception for some 
strings. Your test test_compile.py contains it.

May I ask you to not close this bug therefore, as your proposal is not 
feasible? I really need ast.parse() to return different nodes for the string 
literals d and bd or else I cannot detect the non-unicode literals with 
unicode literals as default.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9690
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9683] Dead code in py3k inspect module

2010-08-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Indeed, with 3.1:

 def f(x, y): pass
...
 inspect.formatargspec(inspect.getargspec(f))
TypeError: object of type 'map' has no len()

--
nosy: +amaury.forgeotdarc
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9683
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1487481] Could BIND_FIRST be removed on HP-UX?

2010-08-26 Thread Göran Uddeborg

Göran Uddeborg goe...@uddeborg.se added the comment:

Although BIND_FIRST is still there, I could not reproduce the problem with 
Python 3.1.2.  If it is because something changed in Python, or that HP-UX has 
fixed something, I don't know.  I still don't see the point in specifying 
BIND_FIRST here.  But in any case I can not reproduce the problem any more.

(I had to do a couple of tweaks to build on HP-UX 11 with the native compiler.  
Is it worthwhile to report them, or is this platform effectively dead from 
Python's point of view?)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1487481
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9572] IOError or OSError in test_multiprocessing

2010-08-26 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Łukasz,

_closing is not necessary on FileIO instances. The class already declares an 
__exit__ method which takes care of closing file.

 import io
 f = io.FileIO('/tmp/test_closing', 'wb')
 f.closed
False

 f.__exit__()
 f.closed
True

Since both IOError and OSError are direct subclasses of EnvironmentError, we 
can use this in the except clause.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9572] IOError or OSError in test_multiprocessing

2010-08-26 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Patch.

--
keywords: +patch
Added file: http://bugs.python.org/file18649/issue9572_oserror.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: [issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp

2010-08-26 Thread Senthil Kumaran
 r84324 (release21-maint)

That should be release27-maint. :)
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp

2010-08-26 Thread Mads Kiilerich

Mads Kiilerich m...@kiilerich.com added the comment:

Senthil, can you tell us why this fix is correct - and convince us that it is 
the Final Fix for this issue? Not because I don't trust you, but because this 
issue has a bad track record.

Some comments/questions to this patch:

Why do 401 require such special handling? Why not handle it like the other 
errors?

How do this work together with 
http://code.google.com/p/support/issues/detail?id=3985 ?

Detail: I'm surprised you don't use reset_retry_count() - that makes it a bit 
harder to grok the code. And the patch doesn't reduce the complexity of the 
code.

But ... I really don't understand ... .retried is a kind of error counter. Why 
do we reset it on errors? I would expect it to be reset on success ... or 
perhaps on anything but 401, 403 and 407. Or perhaps it should be reset 
whenever a new URL is requested.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8797
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9686] asyncore infinite loop on raise

2010-08-26 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

I agree with you that asyncore API model is far from being robust and I've 
personally seen infinite recursion more than once if certain asyncore methods 
aren't properly subclassed.

What I don't understand is what changes you are proposing and, again, it would 
be very helpful if you could provide an example code which demonstrates the 
problems you're complaining about (infinite recursion? broken pipe error? 
both?).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9686
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7005] ConfigParser does not handle options without values

2010-08-26 Thread Dwayne Bailey

Dwayne Bailey dwayne+pythonb...@translate.org.za added the comment:

This is causing a regression in our code.

Previously when we write out our INI file for an entry that has a value of None 
we saw the following:
value = None

These are now stored as:
value

This is now causing a traceback in our code.

But interestingly I haven't changed anything in our initialisation of 
ConfigParser, I would have assumed that I need to set allow_no_value for this 
to work in the new way that MySQL expects.

I would have expected everything to work as it currently does in 2.6 unless I 
specifically request

You can see the traceback of Virtaal under Python 2. in this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=622061

--
nosy: +dwayne

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7005
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9691] sdist includes files that are not in MANIFEST.in

2010-08-26 Thread Ronald Oussoren

New submission from Ronald Oussoren ronaldousso...@mac.com:

The attached file 'manifest-test.zip' is a small distutils project that 
demonstrates a problem I have with the sdist command.

The archive contains a directory 'sandbox' that is not mentioned in MANIFEST.in 
or anywhere in setup.py. When I create an sdist using python setup.py sdist 
the sandbox directory is included in the archive.

This happens with 2.7 on Windows, while 2.7 on OSX does not have this behavior.

--
assignee: tarek
components: Distutils
files: manifest-test.zip
messages: 114966
nosy: eric.araujo, ronaldoussoren, tarek
priority: normal
severity: normal
stage: unit test needed
status: open
title: sdist includes files that are not in MANIFEST.in
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file18650/manifest-test.zip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9691
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9683] Dead code in py3k inspect module

2010-08-26 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

The correct call is more something like 
``inspect.formatargspec(*inspect.getargspec(f))``, which should work for all 
(Python) functions in Python 3. In Python 2, tuple unpacking was represented 
using a nested list for the arguments:

 def f(x, (y, z)): pass
... 
 inspect.getargspec(f).args
['x', ['y', 'z']]

It is impossible to get such a nested list from `getargspec()` now, but if you 
provide one, you execute the dead code path:

 inspect.formatargspec(['x', ['y', 'z']])
TypeError: object of type 'map' has no len()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9683
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7005] ConfigParser does not handle options without values

2010-08-26 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. fdr...@acm.org added the comment:

Re-opening for investigation.

(The previous message really should have been a new issue.)

--
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7005
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7005] ConfigParser does not handle options without values

2010-08-26 Thread Fred L. Drake, Jr.

Changes by Fred L. Drake, Jr. fdr...@acm.org:


--
nosy: +lukasz.langa

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7005
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1552] fromfd() and socketpair() should return wrapped sockets

2010-08-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

fromfd is already taken care of in 3.2. Otherwise, this looks like a good fix 
once updated to trunk.

--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1552
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9690] Cannot distinguish bstr from str in ast module.

2010-08-26 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

I see that it's a problem, but there's nothing we can do about it now, so 
you'll have to determine whether it was unicode literals or not based on 
compile flags.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9690
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1552] fromfd() and socketpair() should return wrapped sockets

2010-08-26 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1552
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9539] python-2.6.4: test failure in test_distutils due to linking to system libpython2.6

2010-08-26 Thread jan matejek

jan matejek jmate...@suse.cz added the comment:

this affects 2.7 as well. the problem was introduced by r78136 which skips out 
of the directory containing newly built libpython2.7, so the linking command 
cannot find it in -L. and fails (unless a systemwide libpython is already 
present)

the tests should probably specify that they want to link to a specific file, 
instead of relying on -lpython
however, i have no idea how to do that in general, let alone within distutils :/

see also issue8335

--
nosy: +matejcik
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9539
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1553375] Add traceback.print_full_exception()

2010-08-26 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
nosy: +vinay.sajip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1553375
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9682] socket.create_connection error message for domain subpart with invalid length is very confusing

2010-08-26 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
assignee:  - loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9682
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1553375] Add traceback.print_full_exception()

2010-08-26 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

This functionality would be useful in format_exception(), too, so it might be 
better to implement in format_exception_only(). This latter function formats 
the exception part of a traceback, so it makes sense to implement it here.

I would prefer fullstack to full as it's clearer what the 'full' pertains 
to. An alternative might be upperframes or allframes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1553375
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9427] logging.error('...', exc_info=True) should display upper frames, too

2010-08-26 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

This also happens on later versions. Since 2.x is essentially frozen, this 
feature request can't be implemented in 2.x, so recategorising as a Python 3.2 
issue.

Here, a change in logging will either duplicate code in traceback.py or print 
the upper frames above the Traceback (most recent call last): line, which is 
not ideal.

The best way to implement in logging would be to wait for the implementation of 
the patch in #1553375, following which a change could be made in 
Formatter.formatException to invoke traceback.print_exception with the 
fullstack keyword parameter.

--
type:  - feature request
versions: +Python 3.2 -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9427
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1403349] in email can't get attachments' filenames using get_filename

2010-08-26 Thread Ich Neumon

Ich Neumon ichneumo...@gmail.com added the comment:

Looks like this one needs reopening to me... I've recently had to parse out 
attachments with the following Content-Type lines and no Content-Disposition 
provided:

Content-Type: application/vnd.ms-excel; name=transactions.xls

It might not seem like much, but the content-type check for this workaround in 
get_filename appears to be case-sensitive, and thus misses the upper case T 
in Content-Type.
There is no information provided in the headers about the mailer they use, but 
they get plenty of other bits wrong too (eg. the xls file is actually just 
tab-separated values).

--
nosy: +ichneumon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1403349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1553375] Add traceback.print_full_exception()

2010-08-26 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
Removed message: http://bugs.python.org/msg114972

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1553375
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1553375] Add traceback.print_full_exception()

2010-08-26 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

This functionality would be useful in format_exception(), too.

I prefer fullstack to full as it's clearer what the 'full' pertains to. An 
alternative might be upperframes or allframes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1553375
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9427] logging.error('...', exc_info=True) should display upper frames, too

2010-08-26 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9427
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8296] multiprocessing.Pool hangs when issuing KeyboardInterrupt

2010-08-26 Thread Andrey Vlasovskikh

Andrey Vlasovskikh andrey.vlasovsk...@gmail.com added the comment:

 On closer look your patch is also ignoring SystemExit. I think it's 
 beneficial to honor SystemExit, so a user could use this as a means to 
 replace the current process with a new one.

Yes, SystemExit should cancel all the tasks that are currently in the queue. I 
guess my patch doesn't handle this properly.

 If we keep that behavior, the real problem here is that the result handler 
 hangs if the process that reserved a job is gone, which is going to be 
 handled by #9205. Should we mark it as a duplicate?

Yes, I think that #9205 covers this issue, so #8296 may be marked as a 
duplicate.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8296
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2010-08-26 Thread Andrey Vlasovskikh

Changes by Andrey Vlasovskikh andrey.vlasovsk...@gmail.com:


--
nosy: +vlasovskikh

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9205
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1403349] in email can't get attachments' filenames using get_filename

2010-08-26 Thread Ich Neumon

Ich Neumon ichneumo...@gmail.com added the comment:

A slight update for my workaround for the above with the following code:

if not filename:
   ct = part.get(Content-Type)
   if ct:
  m = re.compile('name=\?(\S+)\?').search(ct, 1)
  if m: filename = m.group(1)

I've added ? operators to the double-quotes, and changed the case in the 
part.get. However, there may be good reasons as to why part.get needs to be 
case-sensitive. Not my area of expertise though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1403349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9689] threading.Timer poorly documented

2010-08-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in r84326.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9689
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9681] small typo in online documentation

2010-08-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in r84327.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9681
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9692] UnicodeDecodeError in ElementTree.tostring()

2010-08-26 Thread Ulrich Seidl

New submission from Ulrich Seidl ulrich.se...@muneda.com:

The following code leads to an UnicodeError in python 2.7 while it works fine 
in 2.6  2.5:

# -*- coding: latin-1 -*-
import xml.etree.cElementTree as ElementTree

oDoc = ElementTree.fromstring(
'?xml version=1.0 encoding=iso-8859-1?ROOT/' )
oDoc.set( ATTR, ÄÖÜ )
print ElementTree.tostring( oDoc , encoding=iso-8859-1 )

--
components: XML
messages: 114980
nosy: uis
priority: normal
severity: normal
status: open
title: UnicodeDecodeError in ElementTree.tostring()
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9692
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9692] UnicodeDecodeError in ElementTree.tostring()

2010-08-26 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
nosy: +flox
stage:  - needs patch
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9692
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1403349] in email can't get attachments' filenames using get_filename

2010-08-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Also, issue 7082 might be relevant here, since it fixed a bug in this fix.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1403349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9692] UnicodeDecodeError in ElementTree.tostring()

2010-08-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

IMO the code is not correct: how does ElementTree know which encoding is used 
for the attribute value?  Even 2.5 prints a different content when the script 
is saved with a different encoding.

The line should look like:
oDoc.set( ATTR, uÄÖÜ )
or use ascii-only characters.

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9692
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1076515] shutil.move clobbers read-only files.

2010-08-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Brian, Tim, any comments on this wrt Windows or do you think this can be 
closed?  Could there be an impact on any other OS?  I'll close if there's no 
response, unless someone else feels fit to close this anyway.

--
nosy: +BreamoreBoy, brian.curtin, tim.golden
status: open - pending
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1076515
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1078245] Python2.4: building '_socket' extension fails with `INET_ADD

2010-08-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I don't believe that this can still be a problem.

--
nosy: +BreamoreBoy
resolution:  - out of date
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1078245
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1078919] Email.Header encodes non-ASCII content incorrectly

2010-08-26 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
versions: +Python 3.2 -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1078919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1524938] PEP MemoryError with a lot of available memory gc not called

2010-08-26 Thread Mark Matusevich

Mark Matusevich mark...@users.sourceforge.net added the comment:

This is what I got on computer with 512 MB RAM:

Mandriva Linux 2009.1
=
Python 2.6.1 (r261:67515, Jul 14 2010, 09:23:11) [GCC 4.3.2]
- Python process killed by operating system after 14


Microsoft Windows XP Professional
Version 5.1.2600 Service Pack 2 Build 2600
=
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
- MemoryError after 10

Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
- MemoryError after 10

Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]
- MemoryError after 10

Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)]
- Sucessfull finnish in no time!!!

Unfortunately I cannot test the original program I had the problem with, 
because since the original post (2006) I changed the employer. Now I use Matlab 
:(

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1524938
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1080387] Making IDLE Themes and Keys Config more Robust

2010-08-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I'm assuming that the attached patches are simply out of date.

--
nosy: +BreamoreBoy
stage: unit test needed - needs patch
versions: +Python 3.2 -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1080387
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1083299] Distutils doesn't pick up all the files it should.

2010-08-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

@Éric can you please select the appropriate stage, component(s) or version(s) 
as you see fit, thanks.

--
assignee:  - tarek
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1083299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1097797] Encoding for Code Page 273 used by EBCDIC Germany Austria

2010-08-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

The consensus is that this should have gone into Python years ago.

--
nosy: +BreamoreBoy
stage:  - patch review
versions: +Python 3.2 -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1097797
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >