Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
On Jul 22, 12:45 am, Terry Reedy wrote: > On 7/22/2011 12:48 AM, rantingrick wrote: > > On Jul 21, 11:13 pm, Corey Richardson  wrote: > Hmm. Archives are more like directories than files. Windows, at least, > seems to partly treat zipfiles as more or less as such. Yes but a zipfile is just a fil

Re: Question about timeit

2011-07-21 Thread Stefan Behnel
Frank Millman, 22.07.2011 08:06: I mentioned in a recent post that I noticed an inconsistency in timeit, and then reported that I must have made a mistake. I have now identified my problem, but I don't understand it. C:\Python32\Lib>timeit.py "int(float('165.0'))" 10 loops, best of 3: 3.52

Question about timeit

2011-07-21 Thread Frank Millman
Hi all I mentioned in a recent post that I noticed an inconsistency in timeit, and then reported that I must have made a mistake. I have now identified my problem, but I don't understand it. C:\Python32\Lib>timeit.py "int(float('165.0'))" 10 loops, best of 3: 3.52 usec per loop C:\Python

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
On Jul 22, 12:05 am, Corey Richardson wrote: > > >>> from archive import ZipFile, TarFile > > >>> zf = ZipFile(path, *args) > > >>> tf = TarFile(path, *args) > > I have nothing to do this weekend, I might as well either write my own or > twist around the existing implementations in the hg repo.

Re: Convert '165.0' to int

2011-07-21 Thread Frank Millman
On Jul 21, 10:00 pm, Terry Reedy wrote: > On 7/21/2011 10:13 AM, Grant Edwards wrote: > > > On 2011-07-21, Web Dreamer  wrote: > >> Leo Jay a ?crit ce jeudi 21 juillet 2011 11:47 dans > > >> int(x.split('.')[0]) > > >> But, the problem is the same as with int(float(x)), the integer number is > >>

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread Ryan Kelly
On Fri, 2011-07-22 at 01:45 -0400, Terry Reedy wrote: > On 7/22/2011 12:48 AM, rantingrick wrote: > > On Jul 21, 11:13 pm, Corey Richardson wrote: > >> Excerpts from rantingrick's message of Thu Jul 21 23:46:05 -0400 2011: > >> > >>> I may have found the mother of all inconsitency warts when compa

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread Terry Reedy
On 7/22/2011 12:48 AM, rantingrick wrote: On Jul 21, 11:13 pm, Corey Richardson wrote: Excerpts from rantingrick's message of Thu Jul 21 23:46:05 -0400 2011: I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different,

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread Corey Richardson
Excerpts from rantingrick's message of Fri Jul 22 00:48:37 -0400 2011: > On Jul 21, 11:13pm, Corey Richardson wrote: > > I agree, actually. > > > Maybe i can offer a solution. A NEW module called "archive.py" (could > even be a package!) which exports both the zip and tar file classes. > However

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
On Jul 21, 11:13 pm, Corey Richardson wrote: > Excerpts from rantingrick's message of Thu Jul 21 23:46:05 -0400 2011: > > > I may have found the mother of all inconsitency warts when comparing > > the zipfile and tarfile modules. Not only are the API's different, but > > the entry and exits are di

Re: Convert '165.0' to int

2011-07-21 Thread Billy Mays
On 7/21/2011 10:40 PM, Thomas 'PointedEars' Lahn wrote: Billy Mays wrote: On 07/21/2011 08:46 AM, Web Dreamer wrote: If you do not want to use 'float()' try: int(x.split('.')[0]) This is right. Assuming that the value of `x' is in the proper format, of course. Else you might easily cut t

Re: WindowsError: exception: access violation

2011-07-21 Thread Sathish S
Benjamin thanks for replying. i'm not using the python that comes with cygwin. Its the regular python 2.7.2 To add more info I'm opening up a zip file within the DLL. The zip file is located in the same directory. arg1 is the file name arg2 is zip password Thanks, Sathish On Fri, Jul 22, 2011 at

Re: [PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread Corey Richardson
Excerpts from rantingrick's message of Thu Jul 21 23:46:05 -0400 2011: > > I may have found the mother of all inconsitency warts when comparing > the zipfile and tarfile modules. Not only are the API's different, but > the entry and exits are differnet AND zipfile/tarfile do not behave > like prop

Python Game Programming Challenge 13 (September 2011) is coming!

2011-07-21 Thread Richard Jones
The 13th Python Game Programming Challenge (PyWeek) is coming. It'll run from the 11th to the 18th of September. The PyWeek challenge: - Invites entrants to write a game in one week from scratch either as an individual or in a team, - Is intended to be challenging and fun, - Will hopefully increa

[PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different, but the entry and exits are differnet AND zipfile/tarfile do not behave like proper file objects should. >>> import zipfile, tarfile >>> import os >>> os.path.ex

[PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different, but the entry and exits are differnet AND zipfile/tarfile do not behave like proper file objects should. >>> import zipfile, tarfile >>> import os >>> os.path.ex

[PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-21 Thread rantingrick
I may have found the mother of all inconsitency warts when comparing the zipfile and tarfile modules. Not only are the API's different, but the entry and exits are differnet AND zipfile/tarfile do not behave like proper file objects should. >>> import zipfile, tarfile >>> import os >>> os.path.ex

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Ed Leafe
Religious fervor is one thing; freedom of religion is another! ;-) We strive for readability in our code, yet every printed material designed to be read, such as books, newspapers, etc., uses a proportional font. I switched to proportional fonts years ago, and am only reluctantly using fixed wi

reportlab import error after dundled using py2exe

2011-07-21 Thread SANKAR .
Hi all, I bundled a small script written in python using py2exe. The script uses many packages and one of them is reportlab. After bundling using py2exe I tried to run the exe file and it is returning following error: C:\Python26\dist>DELchek.exe Traceback (most recent call last): File "DELchek

Re: A little complex usage of Beautiful Soup Parsing Help!

2011-07-21 Thread Thomas 'PointedEars' Lahn
SAKTHEESH wrote: > I am using Beautiful Soup to parse a html to find all text that is Not > contained inside any anchor elements > > I came up with this code which finds all links within href _anchors_ _with_ `href' _attribute_ (commonly: links.) > but not the other way around. What would tha

Re: Convert '165.0' to int

2011-07-21 Thread Thomas 'PointedEars' Lahn
Billy Mays wrote: > On 07/21/2011 08:46 AM, Web Dreamer wrote: >> If you do not want to use 'float()' try: >> >> int(x.split('.')[0]) > > This is right. Assuming that the value of `x' is in the proper format, of course. Else you might easily cut to the first one to three digits of a string rep

Re: WindowsError: exception: access violation

2011-07-21 Thread Benjamin Kaplan
On Thu, Jul 21, 2011 at 6:42 PM, Sathish S wrote: > Hi Ppl, > >  I have been trying to call a C DLL built in GCC with cygwin and Eclipse IDE > from python. Since this DLL was built using cygwin it had the following two > DLL's as dependency. cygwin1.dll and cyggcc_s-1.dll > > I'm calling the cygwi

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Thomas 'PointedEars' Lahn
Dan Sommers wrote: > bruno.desthuilli...@gmail.com wrote: >> 1/ you can consider the equal sign ('=') is the "binding operator". >> >> 2/ since {'key':'val'} is equivalent to dict(key=val), you can consider >> colons as a binding operator here > > But PEP 8 (under Other Recommendations) indicate

Re: turtles slowing down

2011-07-21 Thread Lee Harr
>  there > was a steady slowing down of turtles as time goes The problem is that when the turtle "draws" it does not just put marks on the canvas, it actually creates new canvas items. Canvas items aren't just pixels on the canvas, they are full-fledged objects which (if you wanted to) you could

WindowsError: exception: access violation

2011-07-21 Thread Sathish S
Hi Ppl, I have been trying to call a C DLL built in GCC with cygwin and Eclipse IDE from python. Since this DLL was built using cygwin it had the following two DLL's as dependency. cygwin1.dll and cyggcc_s-1.dll I'm calling the cygwin_dll_init method in the cygwin1.dll before accessing my DLL. W

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Dan Sommers
On Thu, 21 Jul 2011 13:28:52 -0700, bruno.desthuilli...@gmail.com wrote: > 1/ you can consider the equal sign ('=') is the "binding operator". > > 2/ since {'key':'val'} is equivalent to dict(key=val), you can consider > colons as a binding operator here But PEP 8 (under Other Recommendations) i

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Roy Smith
In article , Terry Reedy wrote: > Whether or not they are intended, the rationale is that lining up does > not work with proportional fonts. There are very few things I am absolutely religious about, but programming in a fixed width font is one of them. -- http://mail.python.org/mailman/list

Re: I am fed up with Python GUI toolkits...

2011-07-21 Thread Gregory Ewing
Andrew Berg wrote: It has quite a few external dependencies, though (different dependencies for each platform, so it requires a lot to be cross-platform). I think that's a bit of an exaggeration -- there's only one major dependency on each platform, and it's a very widely used one (currently P

Re: I am fed up with Python GUI toolkits...

2011-07-21 Thread Gregory Ewing
sturlamolden wrote: Or should modern deskop apps be written with something completely different, such as HTML5? I hope not! HTML is great for web pages, but not everything should be a web page. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: // about building python //

2011-07-21 Thread Thomas Jollans
On 22/07/11 00:13, victor lucio wrote: > Hi All, > > I'd like to embbed a thin python in one application of mine i'm > developing so I need to know the module dependencies because I'm going > to remove some modules. > I also need to know the best way to rebuild the python core once these > modules

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Terry Reedy
On 7/21/2011 2:46 PM, Andrew Berg wrote: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.21 01:32 PM, Thomas Jollans wrote: So, the PEP says: do not align operators. End of story. I'm pretty sure that colons, commas and equals signs are not operators. Whether or not they are in

Re: a little parsing challenge ☺

2011-07-21 Thread Terry Reedy
On 7/21/2011 2:53 PM, Xah Lee wrote: had hopes that parser expert would show some proper parser solutions… in particular i think such can be expressed in Parsing Expression Grammar in just a few lines… but so far no deity came forward to show the light. lol I am not a parser expert but 20 year

tab completion

2011-07-21 Thread Chess Club
Could someone help me change the tab completion setting in iPython on a Windows machine? I would like it to cycle through the available completions Thank you. -- http://mail.python.org/mailman/listinfo/python-list

// about building python //

2011-07-21 Thread victor lucio
Hi All, I'd like to embbed a thin python in one application of mine i'm developing so I need to know the module dependencies because I'm going to remove some modules. I also need to know the best way to rebuild the python core once these modules have been removed. So, could you provide me some po

Re: a little parsing challenge ☺

2011-07-21 Thread Rouslan Korneychuk
On 07/21/2011 09:23 AM, Xah Lee wrote: Thanks for the code. are you willing to make it complete and standalone? i.e. i can run it like this: perl Rouslan_Korneychuk.pl dirPath and it prints any file that has mismatched pair and line/column number or the char position? Since you asked, I put

Re: Crazy what-if idea for function/method calling syntax

2011-07-21 Thread ΤΖΩΤΖΙΟΥ
Thanks for your input, everyone. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread bruno.desthuilli...@gmail.com
On 21 juil, 20:46, Andrew Berg wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: RIPEMD160 > > On 2011.07.21 01:32 PM, Thomas Jollans wrote:> So, the PEP says: do not align > operators. End of story. > > I'm pretty sure that colons, commas and equals signs are not operators. 1/ you can consid

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread rantingrick
On Jul 21, 1:46 pm, Andrew Berg wrote: > [snip PGP noise!] > On 2011.07.21 01:32 PM, Thomas Jollans wrote: > So, the PEP says: do not align operators. End of story. > > I'm pretty sure that colons, commas and equals signs are not operators. 'au contraire mon frere'. Colons in a dictionary are as

Re: Convert '165.0' to int

2011-07-21 Thread Terry Reedy
On 7/21/2011 10:13 AM, Grant Edwards wrote: On 2011-07-21, Web Dreamer wrote: Leo Jay a ?crit ce jeudi 21 juillet 2011 11:47 dans int(x.split('.')[0]) But, the problem is the same as with int(float(x)), the integer number is still not as close as possible as the original float value. Nobo

Re: a little parsing challenge ☺

2011-07-21 Thread Xah Lee
On Jul 21, 9:43 am, pyt...@bdurham.com wrote: > Xah, > > 1. Is the following string considered legal? > > [ { ( ] ) } > > Note: Each type of brace opens and closes in the proper sequence. But > inter-brace opening and closing does not make sense. nu! > Or must a closing brace always balance out

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Neil Cerutti
On 2011-07-21, Brandon Harris wrote: > I don't really think lining things up makes them any easier to > read. In fact, the consistency in a single space on either side > of an operator keeps things neat and clean. Also easier to > maintain in any editor. Always lining up columns of stuff > require

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Brandon Harris
I don't really think lining things up makes them any easier to read. In fact, the consistency in a single space on either side of an operator keeps things neat and clean. Also easier to maintain in any editor. Always lining up columns of stuff requires readjusting text every time you add a new

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.21 01:32 PM, Thomas Jollans wrote: > So, the PEP says: do not align operators. End of story. I'm pretty sure that colons, commas and equals signs are not operators. - -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/

Re: PEP 8 and extraneous whitespace

2011-07-21 Thread Thomas Jollans
On 21/07/11 19:51, Andrew Berg wrote: > Looks nice all lined up, but it violates PEP 8 because of those extra > spaces, which is only because extra spaces look bad in one-line > assignments that have nothing to do with lists/tuples or dictionaries. > This is one of those times not to follow PEP 8 t

Re: Can someone help please

2011-07-21 Thread D'Arcy J.M. Cain
On Thu, 21 Jul 2011 18:43:48 +0100 Gary Wood wrote: > Hi > Thanks for your reply's > and sorry guys for not explaining properly > ok the problem with the code, which i never realised before, is it sends the > first txt file as the header or subject field in an email and the rest in > the body of t

Re: Can someone help please

2011-07-21 Thread Billy Mays
On 07/21/2011 01:41 PM, Gary Herron wrote: On 07/21/2011 10:23 AM, Billy Mays wrote: On 07/21/2011 01:02 PM, Gary wrote: Hi Can someone help me with this code below please, For some reason it will not send me the first text file in the directory. I made up an empty file a.txt file with nothing

PEP 8 and extraneous whitespace

2011-07-21 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I found a couple things that I think should be tweaked in PEP 8. I don't agree with everything in PEP 8, but I'm not going to debate /those/ points; rather I'm bringing up a couple examples that violate PEP 8, but don't apply to the reasons given

Re: Can someone help please

2011-07-21 Thread Gary Wood
Hi Thanks for your reply's and sorry guys for not explaining properly ok the problem with the code, which i never realised before, is it sends the first txt file as the header or subject field in an email and the rest in the body of the email which i don't want. I would like all the txt files in th

Re: Can someone help please

2011-07-21 Thread Gary Herron
On 07/21/2011 10:23 AM, Billy Mays wrote: On 07/21/2011 01:02 PM, Gary wrote: Hi Can someone help me with this code below please, For some reason it will not send me the first text file in the directory. I made up an empty file a.txt file with nothing on it and it sends the files i need but wo

Re: Scikits.timeseries for 2.7

2011-07-21 Thread Vlastimil Brom
2011/7/21 JB : > I'm currently using python 2.7, with numpy and scipy already > installed, but I can't seem to install Scikits.timeseries. I've > downloaded the windows installer from sourceforge, but when I run it, > it checks for a 2.6 installation, and obviously doesn't find the 2.7 > folder. An

Re: Can someone help please

2011-07-21 Thread Gary Herron
On 07/21/2011 10:02 AM, Gary wrote: Hi Can someone help me with this code below please, For some reason it will not send me the first text file in the directory. I made up an empty file a.txt file with nothing on it and it sends the files i need but would like to fix the code. Thanks total

Re: Can someone help please

2011-07-21 Thread Billy Mays
On 07/21/2011 01:02 PM, Gary wrote: Hi Can someone help me with this code below please, For some reason it will not send me the first text file in the directory. I made up an empty file a.txt file with nothing on it and it sends the files i need but would like to fix the code. Thanks total =

Re: Can someone help please

2011-07-21 Thread woooee
On Jul 21, 10:02 am, Gary wrote: > For some reason it will not send me the first text file in the directory. You have to print an unsorted list of the directory to know the name or the first file in the directory. Files are not stored on disk in alphabetical order, but are many times sorted in a

Can someone help please

2011-07-21 Thread Gary
Hi Can someone help me with this code below please, For some reason it will not send me the first text file in the directory. I made up an empty file a.txt file with nothing on it and it sends the files i need but would like to fix the code. Thanks total = ' ' os.chdir('/home/woodygar/Deskto

Scikits.timeseries for 2.7

2011-07-21 Thread JB
I'm currently using python 2.7, with numpy and scipy already installed, but I can't seem to install Scikits.timeseries. I've downloaded the windows installer from sourceforge, but when I run it, it checks for a 2.6 installation, and obviously doesn't find the 2.7 folder. Anyone know of a 2.7 instal

Re: a little parsing challenge ☺

2011-07-21 Thread python
Xah, 1. Is the following string considered legal? [ { ( ] ) } Note: Each type of brace opens and closes in the proper sequence. But inter-brace opening and closing does not make sense. Or must a closing brace always balance out with the most recent opening brace like so? [ { ( ) } ] 2. If the

Re: a little parsing challenge ☺

2011-07-21 Thread Xah Lee
Ok. Here's a preliminary report. 〈Lisp, Python, Perl, Ruby … Code to Validate Matching Brackets〉 http://xahlee.org/comp/validate_matching_brackets.html it's taking too much time to go thru. right now, i consider only one valid code, by Raymond Hettinger (with minor edit from others). right now,

Re: I am fed up with Python GUI toolkits...

2011-07-21 Thread Kevin Walzer
On 7/20/11 9:05 AM, rantingrick wrote: On Jul 19, 9:44 pm, Kevin Walzer wrote: 2. Bloatware. Qt and wxWidgets are C++ application frameworks. (Python has a standard library!) Again, so? This isn't applicable to Tk, by the way. It's a GUI toolkit specifically designed for scripting languages.

Re: a little parsing challenge ☺

2011-07-21 Thread Ian Kelly
On Thu, Jul 21, 2011 at 6:58 AM, Xah Lee wrote: > Thanks a lot for the fix Raymond. That fix was from Thomas Jollans, not Raymond Hettinger. > Though, the code seems to have a minor problem. > It works, but the report is wrong. > e.g. output: > > 30068: c:/Users/h3/web/xahlee_org/p/time_machine\

Re: Convert '165.0' to int

2011-07-21 Thread Grant Edwards
On 2011-07-21, Web Dreamer wrote: > Leo Jay a ?crit ce jeudi 21 juillet 2011 11:47 dans > int(x.split('.')[0]) > > But, the problem is the same as with int(float(x)), the integer number is > still not as close as possible as the original float value. Nobody said that "close as possible to the o

Re: Convert '165.0' to int

2011-07-21 Thread Billy Mays
On 07/21/2011 08:46 AM, Web Dreamer wrote: If you do not want to use 'float()' try: int(x.split('.')[0]) This is right. But, the problem is the same as with int(float(x)), the integer number is still not as close as possible as the original float value. I would in fact consider doing this:

Re: a little parsing challenge ☺

2011-07-21 Thread Xah Lee
2011-07-21 On Jul 18, 12:09 am, Rouslan Korneychuk wrote: > I don't know why, but I just had to try it (even though I don't usually > use Perl and had to look up a lot of stuff). I came up with this: > > /(?| >      (\()(?&matched)([\}\]”›»】〉》」』]|$) | >      (\{)(?&matched)([\)\]”›»】〉》」』]|$) | >

Re: a little parsing challenge ☺

2011-07-21 Thread Thomas Jollans
On 21/07/11 14:29, Xah Lee wrote: > On Jul 19, 11:14 am, Thomas Jollans wrote: >> I thought I'd have some fun with multi-processing: > > Nice joke. ☺ > >> Here's a sane version: >> >> https://gist.github.com/1087682/2240a0834463d490c29ed0f794ad15128849ff8e > > hi thomas, > > i still cant get y

Re: a little parsing challenge ☺

2011-07-21 Thread Xah Lee
On Jul 19, 11:07 am, Thomas Jollans wrote: > On 19/07/11 18:54, Xah Lee wrote: > > > > > > > > > > > On Sunday, July 17, 2011 2:48:42 AM UTC-7, Raymond Hettinger wrote: > >> On Jul 17, 12:47 am, Xah Lee wrote: > >>> i hope you'll participate. Just post solution here. Thanks. > > >>http://pastebin

Re: a little parsing challenge ☺

2011-07-21 Thread Xah Lee
On Jul 19, 11:14 am, Thomas Jollans wrote: > I thought I'd have some fun with multi-processing: Nice joke. ☺ > Here's a sane version: > > https://gist.github.com/1087682/2240a0834463d490c29ed0f794ad15128849ff8e hi thomas, i still cant get your code to work. I have a dir named xxdir with a sing

Re: Convert '165.0' to int

2011-07-21 Thread Frank Millman
> > [1] See separate thread on apparent inconsisteny in timeit timings.- Hide > quoted text - > I must have done something wrong - it is consistent now. Here are the results - C:\Python32\Lib>timeit.py "int(float('165.0'))" 10 loops, best of 3: 3.51 usec per loop C:\Python32\Lib>timeit.py

Re: Convert '165.0' to int

2011-07-21 Thread Frank Millman
On Jul 21, 11:53 am, Thomas Jollans wrote: > On 21/07/11 11:31, Frank Millman wrote: > > > Hi all > > > I want to convert '165.0' to an integer. > > Well, it's not an integer. What does your data look like? How do you > wish to convert it to int? Do they all represent decimal numbers? If so, > how

Re: Convert '165.0' to int

2011-07-21 Thread Frank Millman
On Jul 21, 11:47 am, Leo Jay wrote: > On Thu, Jul 21, 2011 at 5:31 PM, Frank Millman wrote: > > > Hi all > > > I want to convert '165.0' to an integer. > > > The obvious method does not work - > > x = '165.0' > int(x) > > > Traceback (most recent call last): > >  File "", line 1, in >

Re: Convert '165.0' to int

2011-07-21 Thread Thomas Jollans
On 21/07/11 11:31, Frank Millman wrote: > Hi all > > I want to convert '165.0' to an integer. Well, it's not an integer. What does your data look like? How do you wish to convert it to int? Do they all represent decimal numbers? If so, how do you want to round them? What if you get '165.xyz' as i

Re: Convert '165.0' to int

2011-07-21 Thread Leo Jay
On Thu, Jul 21, 2011 at 5:31 PM, Frank Millman wrote: > > Hi all > > I want to convert '165.0' to an integer. > > The obvious method does not work - > x = '165.0' int(x) > > Traceback (most recent call last): >  File "", line 1, in > ValueError: invalid literal for int() with base 10: '

Convert '165.0' to int

2011-07-21 Thread Frank Millman
Hi all I want to convert '165.0' to an integer. The obvious method does not work - x = '165.0' int(x) Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '165.0' If I convert to a float first, it does work - int(float(x)) 165 Is

Re: How to get number of bytes written to nonblocking FIFO when EAGAIN is raised?

2011-07-21 Thread Aaron Staley
On Jul 19, 8:15 pm, Adam Skutt wrote: > On Jul 19, 9:19 pm, Aaron Staley wrote: > > > However, if interpreter 1 overfills the FIFO, we get an error (EAGAIN)>>> > > f.write('a'*7) > > > IOError: [Errno 11] Resource temporarily unavailable > > > However interpreter 2 still receives data>> len(