Re: Mock object bug with assert_not_called

2016-12-27 Thread Steve D'Aprano
On Wed, 28 Dec 2016 07:15 am, Diego Vela wrote: > Dear all, > >>From reading the documentation it seemed like this is the place to post a > bug. If not please let me know where is the proper place to do so. Once you are sure that it truly is a bug, then the proper place is the bug tracker: htt

Re: encoding="utf8" ignored when parsing XML

2016-12-27 Thread Steve D'Aprano
On Wed, 28 Dec 2016 02:05 am, Skip Montanaro wrote: > I am trying to parse some XML which doesn't specify an encoding (Python > 2.7.12 via Anaconda on RH Linux), so it barfs when it encounters non-ASCII > data. No great surprise there, but I'm having trouble getting it to use > another encoding. F

Re: ctypes, memory mapped files and context manager

2016-12-27 Thread Peter Otten
Hans-Peter Jansen wrote: > Hi, > > I'm using $subjects combination successfully in a project for > creating/iterating over huge binary files (> 5GB) with impressive > performance, while resource usage keeps pretty low, all with plain Python3 > code. Nice! > > Environment: (Python 3.4.5, Linux 4.

Mock object bug with assert_not_called

2016-12-27 Thread Diego Vela
Dear all, >From reading the documentation it seemed like this is the place to post a bug. If not please let me know where is the proper place to do so. Bug: For mock objects created using the @patch decorator the following methods are inconsistent. assert_not_called, assert_called_with Steps Cr

Re: Parse a Wireshark pcap file

2016-12-27 Thread 1991manish . kumar
I have a pcap file, I want to parse that file & fetch some information like Timestamp, Packet Size, Source/Dest IP Address, Source/Dest Port, Source/ Dest MAC address. I am trying this in Django. other that Source/ Dest Port details, I am able to fetch everything. Please tell me how I can get

Re: encoding="utf8" ignored when parsing XML

2016-12-27 Thread Peter Otten
Peter Otten wrote: > works, but to go back to the bytes that the XML parser needs the > "preferred encoding", in your case ASCII, will be used. Correction: it's probably sys.getdefaultencoding() rather than locale.getdefaultencoding(). So all systems with a sane configuration will behave the sa

Re: encoding="utf8" ignored when parsing XML

2016-12-27 Thread Peter Otten
Skip Montanaro wrote: > Peter> Isn't UTF-8 the default? > > Apparently not. Sorry, I meant the default for XML. > I believe in my reading it said that it used whatever > locale.getpreferredencoding() returned. That's problematic when you > live in a country that thinks ASCII is everything. Per

Re: encoding="utf8" ignored when parsing XML

2016-12-27 Thread Skip Montanaro
Peter> Isn't UTF-8 the default? Apparently not. I believe in my reading it said that it used whatever locale.getpreferredencoding() returned. That's problematic when you live in a country that thinks ASCII is everything. Personally, I think UTF-8 should be the default, but that train's long left t

Re: encoding="utf8" ignored when parsing XML

2016-12-27 Thread Peter Otten
Skip Montanaro wrote: > I am trying to parse some XML which doesn't specify an encoding (Python > 2.7.12 via Anaconda on RH Linux), so it barfs when it encounters non-ASCII > data. No great surprise there, but I'm having trouble getting it to use > another encoding. First, I tried specifying the e

encoding="utf8" ignored when parsing XML

2016-12-27 Thread Skip Montanaro
I am trying to parse some XML which doesn't specify an encoding (Python 2.7.12 via Anaconda on RH Linux), so it barfs when it encounters non-ASCII data. No great surprise there, but I'm having trouble getting it to use another encoding. First, I tried specifying the encoding when opening the fil

ctypes, memory mapped files and context manager

2016-12-27 Thread Hans-Peter Jansen
Hi, I'm using $subjects combination successfully in a project for creating/iterating over huge binary files (> 5GB) with impressive performance, while resource usage keeps pretty low, all with plain Python3 code. Nice! Environment: (Python 3.4.5, Linux 4.8.14, openSUSE/x86_64, NFS4 and XFS fil

Re: windows utf8 & lxml

2016-12-27 Thread Steve D'Aprano
On Tue, 20 Dec 2016 10:53 pm, Sayth Renshaw wrote: > content.read().encode('utf-8'), parser=utf8_parser) > > However doing it in such a fashion returns this error: > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: > invalid start byte That tells you that the XML file