Re: serial module

2012-05-22 Thread Grant Edwards
# close port And here to try to open and already-opened port: > ser.open() > > Why do I get this error? Becaue the port is already opened. :) -- Grant Edwards grant.b.edwardsYow! Sign my PETITION. at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: serial module

2012-05-22 Thread Grant Edwards
On 2012-05-19, Paul Simon wrote: > "Ron Eggler" wrote: >> [...] my code looks like this: >> #!/usr/bin/python [...] >>port='/dev/ttyUSB0', > Sounds like you may be using this on a Windows machine. I don't think so. :) -- Grant

Re: serial module

2012-05-22 Thread Grant Edwards
On 2012-05-22, John Nagle wrote: > On 5/22/2012 8:42 AM, Grant Edwards wrote: >> On 2012-05-22, Albert van der Horst wrote: > >>> It is anybody's guess what they do in USB. >> >> They do exactly what they're supposed to regardless of what sort of >

Re: serial module

2012-05-22 Thread Grant Edwards
re were issues with this. I've used probably a dozen different ones. I've read about some people having odd problems with them, but I've never seen any of the those problems. They've all "just worked" for me. -- Grant Edwards

Re: Email Id Verification

2012-05-25 Thread Grant Edwards
kes your users hate your > program? Don't do it! Write good code, useful code! Validating email > addresses is the wrong thing to do. I have to agree with Steven. Nothing will make your users swear at you as certainly as when you refuse to accept the e-mail address at which the reeiv

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Grant Edwards
eted over the years via some sort of random-walk process. PHP seems to encourage (if not require) bad practices such as returning values from functions via global or instance variables. -- Grant Edwards grant.b.edwardsYow! ! I'm in a very

Re: Pythonic cross-platform GUI desingers ?? la Interface Builder (Re: what gui designer is everyone using)

2012-06-14 Thread Grant Edwards
ou ever tried to _use_ a program built by a casual user? [OK, I'm half joking.] If casual users want a GUI builder they can use, then let 'em write one...:) -- Grant Edwards grant.b.edwardsYow! My nose feels like a at

Re: float("nan") in set or as key

2011-06-02 Thread Grant Edwards
ickle et al. 2) The string representations produced by repr() and accepted by float() weren't standardized across platforms. I think the latter has finally been fixed, hasn't it? -- Grant Edwards grant.b.edwardsYow! Remember, in 2039,

Re: float("nan") in set or as key

2011-06-03 Thread Grant Edwards
On 2011-06-02, Nobody wrote: > On Thu, 02 Jun 2011 09:54:30 +, Steven D'Aprano wrote: > >>> Exceptions allow you to write more natural code by ignoring the >>> awkward cases. E.g. writing "x * y + z" rather than first determining >>> whether "x * y" is even defined then using a conditional. >>

Re: float("nan") in set or as key

2011-06-06 Thread Grant Edwards
-of-A, I have a brief mental clash that, > if I am not careful, could result in various bad things. :-) I find that I do mostly OK driving "on the wrong side of the road" [except for the constant windshield/turn-signal mixups], but I have a horrible time as a

Re: float("nan") in set or as key

2011-06-06 Thread Grant Edwards
a behavior that's the same as with quiet NaNs? >>>> The correct answer to "nan == nan" is to raise an exception, >>>> because you have asked a question for which the answer is nether True >>>> nor False. >>> >>> Wrong. >>

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-13 Thread Grant Edwards
On 2011-06-14, Gregory Ewing wrote: > Chris Angelico wrote: > >> And did any of the studies take into account the fact that a lot of >> computer users - in all but the purest data entry tasks - will use a >> mouse as well as a keyboard? > > What I think's really stupid is designing keyboards with

Re: search through this list's email archives

2011-06-24 Thread Grant Edwards
rovides a search capability also: > http://blog.gmane.org/gmane.comp.python.general FWIW, I've found the Gmane search feature to be very unreliable. It often overlooks a lot of matching articles for no apparent reason. -- Grant Edwards grant.b.edwardsYow! Were the

Re: Safely modify a file in place -- am I doing it right?

2011-06-29 Thread Grant Edwards
That's how Unix programs have modified files "in place" since time immemorial. > Is there a better/safer way? Many programs rename the original file with a "backup" suffix (a tilde is popular). -- Grant Edwards grant.b.edwardsYow! It's NO USE ... I've at gone to "CLUB MED"!! gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem!!

2011-07-03 Thread Grant Edwards
On 2011-07-03, amir chaouki wrote: > i have written code on linux for parsing text files and it works great > but when i try to run it on windows it goes crazy, do you have any > idea??? Yes. -- Grant Edwards grant.b.edwardsYow! LOOK!

Re: Testing if a global is defined in a module

2011-07-05 Thread Grant Edwards
there a reason for not using Doxygen / Autodoc / etc, or at least > something in the same style? They work from specially-formatted > comments in the source code, rather than the compiled module object. Because those specially-formatted comments are wrong. -- Grant Edwards

Re: Testing if a global is defined in a module

2011-07-05 Thread Grant Edwards
thon feature I didn't know about > or have forgotten. You could probably implement at least two more languages using nothing but Python features I don't know about or have forgotten. :) Yet I still manage to get a lot accomplished using Python. -- Grant Edwards

Re: Testing if a global is defined in a module

2011-07-05 Thread Grant Edwards
On 2011-07-05, Waldek M. wrote: > Dnia Tue, 5 Jul 2011 14:11:56 + (UTC), Grant Edwards napisa?(a): >> Because those specially-formatted comments are wrong. > > ... because? In my experience, they're wrong because somebody changes the code and not the comments. > No

Re: Testing if a global is defined in a module

2011-07-07 Thread Grant Edwards
you have in mind > any better replacement? You write code that's easy to read, and you provide the language with introspection capabilities that allow you do do things like write a program that will list the symbols exported by a module. -- Grant Edwards grant.b.edwards

Re: Serial & reset of the device

2011-07-08 Thread Grant Edwards
TR and RTS off when a port is closed and turns them on when it's opened. I don't know what Windows does. A quick glance through the pyserial sources shows that it turns on DTR and RTS when a port is opened, and does nothing with them when a port is closed. If you need RTS/DTR to stay in

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-11 Thread Grant Edwards
nto one line. >> e.g. if a == 1: print a >> >> However I do not find it to be a particularly strong argument. I think >> PEP8 does not recommend this kind of coding style anyway, so one-liner >> should not be used in the first place! > > Basically, it looks better

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-13 Thread Grant Edwards
noun in the sentence makes it abundantly clear whether the noun is an object or a subject, yet we still often have two cases (it's "I run" rather than "Me run"). -- Grant Edwards grant.b.edwardsYow! I'm having an

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-13 Thread Grant Edwards
gives the reader a clue to expect additional information, > that the indented block that follows is not an independent > block, floating in space for its own reasons, but is intimately > linked to the previous line. Yup. [1] Since all posts criticising grammar or s

Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-14 Thread Grant Edwards
On 2011-07-13, Thorsten Kampe wrote: > * Grant Edwards (Wed, 13 Jul 2011 13:03:22 + (UTC)) >> On 2011-07-13, Thorsten Kampe wrote: >> >> >> and that that block is to be considered in relation to what was just >> >> said, before the colon. >> >

Re: os.path.isdir do not work for Foder named '2011-07-03'

2011-07-19 Thread Grant Edwards
>>>> os.path.isdir("C:\Users\??\Desktop\logs\2011-07-03") > False You're not using backslashes corrrectly. Try assigning the path names to a "variable" and printing them. I think you'll see what's wrong. I

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

2011-07-20 Thread Grant Edwards
. (and > PyPy, apparently) And there are always people trying to figure out how to get rid of it. So far the cures have been worse than the disease, but that may not always be the case... -- Grant Edwards grant.b.edwardsYow! ... the HIGHWAY is

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

2011-07-20 Thread Grant Edwards
> has a standard library!) > > I've no idea what this means. I happily use pygtk. I agree. PyGTK works great -- on platforms where GTK works great. -- Grant Edwards grant.b.edwardsYow! !! I am having fun!!! at

Re: Convert '165.0' to int

2011-07-21 Thread Grant Edwards
"close as possible to the original float value" was the goal. Perhaps the OP just wants it truncated. -- Grant Edwards grant.b.edwardsYow! OVER the underpass! at UNDER the overpass! gma

Re: Convert '165.0' to int

2011-07-22 Thread Grant Edwards
to import decimal and use it >>> for rounding to work properly. >> >> It should be floor() though, for that is what int() does. > > Um, what? The example given by the OP implied that int(float(s)) did what he wanted. That is _not_ rounding the float. It's the equiv

Re: Convert '165.0' to int

2011-07-22 Thread Grant Edwards
On 2011-07-22, Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: > On 07/22/2011 10:21 AM, Grant Edwards wrote: >> While that may be clear to you, that's because you've made some >> assumptions. "Convert a properly formatted st

Re: Convert '165.0' to int

2011-07-22 Thread Grant Edwards
On 2011-07-22, Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: > On 07/22/2011 10:58 AM, Grant Edwards wrote: >> On 2011-07-22, Billy >> Mays<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote: >>> Proper

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

2011-07-24 Thread Grant Edwards
On 2011-07-24, John Nagle wrote: > On 7/19/2011 7:34 PM, Andrew Berg wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: RIPEMD160 >> >> There's PyGUI, which, at a glance, fits whit what you want. Looks like >> it uses OpenGL and native GUI facilities. >> http://www.cosc.canterbury.ac.nz/greg.ew

Re: PyWart: os.path needs immediate attention!

2011-07-30 Thread Grant Edwards
On 2011-07-30, Michael Poeltl wrote: > join 'Python-Dev'-mailinglist and tell them! > > from now on I will just ignore threads you initiated > > does trolling really make that much fun? RR must think so, considering how much effort he seems to put into it. It

Re: Hardlink sub-directories and files

2011-08-03 Thread Grant Edwards
ht. > I suppose it is a good thing systems don't allow that now. It wouldn't be a problem, except there are some important places in Unix where it is assume that filesystems are trees. Hard linking directories causes that assumption to be false. -- Grant

Re: Get the name of a function

2011-08-05 Thread Grant Edwards
quot; probably isn't what you're interested in: http://www.ibm.com/developerworks/library/l-pyint/index.html Here's a stack-overflow question similar to yours: http://stackoverflow.com/questions/1538342/how-can-i-get-the-name-of-an-object-in-python -- Grant Edwards

Re: Methods on file-like objects can only used once on one object?

2011-08-23 Thread Grant Edwards
nd read it again, you have to use > the seek method: > > f.seek(0) It's too bad Python doesn't support the f.rewind() spelling for that operation. Rewinding disk files always made me smile... -- Grant Edwards grant.b.edwardsYow! Did I say I was

Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Grant Edwards
erver service, and I need to get the packages sent to the old server >> and send them to my new server service to make sure it works well >> .How can I get the package and resent them to my new service? Is >> there such a tool or is there some functionality that tools such as

Re: Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread Grant Edwards
On 2011-08-31, Steven D'Aprano wrote: > Well obviously the C++ people thought so :) Well _that's_ certainly a ringing endorsement in the context of designing a language that's easy to understand and use. ;) -- Grant Edwards grant.b.edwardsYow! Wh

Re: Threads in Python

2011-09-01 Thread Grant Edwards
On 2011-09-01, Stephen Hansen wrote: > On 9/1/11 2:45 PM, George Kovoor wrote: >> Why doesn't python threads show an associated PID? On spawning >> python threads using the threading module I can only see the main >> thread's pid on using top or ps unix command, no subprocesses are >> displayed.

Re: Python fails on math

2011-02-24 Thread Grant Edwards
On 2011-02-25, Steven D'Aprano wrote: >> C double *variables* are, but as John suggests, C compilers are allowed >> (to my knowledge) to keep intermediate results of an expression in the >> larger-precision FPU registers. The final result does get shoved back >> into a 64-bit double when it is at

Re: Python fails on math

2011-02-24 Thread Grant Edwards
On 2011-02-25, Westley Mart?nez wrote: > Maybe I'm wrong, but wouldn't compiling Python with a compiler that > supports extended precision for intermediates allow Python to use > extended precision for its immediates? I'm not sure what you mean by "immediates", but I don't think so. For the C c

Re: urlopen returns forbidden

2011-02-28 Thread Grant Edwards
Referrer header for pages that don't allow direct-linking from "outside". As somebody else has already said, if the site provides an API that they want you to use you should do so rather than hammering their web server with a screen-scraper. Not only is is a lot less load on the sit

Re: Callbacks on program exiting/aborting

2011-03-03 Thread Grant Edwards
On 2011-03-03, Pengcheng Chen wrote: > What callback mechanisms can we use in Python? We have some device > drivers are in Python and sometimes they crash. I'd like to do some > cleanup before program abort/crash. Any suggestions? http://docs.python.org/library/atexit.html --

Re: question about endswith()

2011-03-03 Thread Grant Edwards
pect it to do, 2) what you see it do. IMPORTANT: Do _not_ retype code, input or output into your posting. Cut/paste both code and input/output into your posting. -- Grant Edwards grant.b.edwardsYow! How's it going in

Re: question about endswith()

2011-03-03 Thread Grant Edwards
On 2011-03-04, Matt Funk wrote: > Hi Grant, > first of all sorry for the many typos in my previous email. > > To clarify, I have a python list full of file names called 'files'. > Every single filename has extension='.hdf' except for one file which has > an '.hdf5' extension. When i do (and yes, t

Re: What do I need to know in order to write a web application in python?

2011-03-06 Thread Grant Edwards
On 2011-03-05, ErichCart ErichCart wrote: > Visual Python seems to be exactly what I want. But it doesn't seem > very popular. Perhaps it means that there are not many people who will > be able to help if I have problems with it. Also judging by the amount > of ads at visualpython.org, it also do

Re: attach to process by pid?

2011-03-09 Thread Grant Edwards
quot;other end" of the pipe or pty to which the program's stdin/stdout is attached. -- Grant Edwards grant.b.edwardsYow! All of life is a blur at of Republicans and meat! gmail.com

Re: Purely historic question: VT200 text graphic programming

2011-03-10 Thread Grant Edwards
but that was a long time ago (25 years). At first first I thought he was talking about ReGIS, but that wasn't available on the vt200 (it was on vt240/330/340). -- Grant Edwards grant.b.edwardsYow! I didn't order any at WOO-

Re: Purely historic question: VT200 text graphic programming

2011-03-10 Thread Grant Edwards
. It was a character-based, mostly-ANSI-escape-sequence, computer terminal connected via async serial (RS-232 typically) to a mini/mainframe computer (a DEC VAX running VMS in this context). -- Grant Edwards grant.b.edwardsYow! Gibble, Gobble, we

Re: Purely historic question: VT200 text graphic programming

2011-03-10 Thread Grant Edwards
On 2011-03-10, GrayShark wrote: > On Thu, 10 Mar 2011 18:02:41 +0000, Grant Edwards wrote: > >> On 2011-03-10, Adam Tauno Williams wrote: >>> On Thu, 2011-03-10 at 00:38 -0600, GrayShark wrote: >>>> Once, many, many, years ago, I programmed some type of 

Re: attach to process by pid?

2011-03-10 Thread Grant Edwards
riting to /proc/fd/7346/fd/2 sends the data to the tty where the write was done, since /proc/fd/7346/fd/2 points to /dev/tty, and /dev/tty points to different things depending on who's doing the writing. There are _some_ cases where you can write to /proc/

Re: attach to process by pid?

2011-03-10 Thread Grant Edwards
x@frittenbude:~$ grep foobar >> >> 2: >> alex@frittenbude:~$ ps ax|grep 'grep foobar' >> 13075 pts/4 ?? ??S+ ?? ?? 0:00 grep --color=auto grep foobar >> alex@frittenbude:~$ echo foobar > /proc/13075/fd/0 > > This works fine on the

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
On 2011-03-11, Dennis Lee Bieber wrote: > On Thu, 10 Mar 2011 19:55:02 + (UTC), Grant Edwards > declaimed the following in > gmane.comp.python.general: > >> vt200 terminals. The vt200 wasn't a TV. It was a character-based, >> mostly-ANSI-escape-sequence, co

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
On 2011-03-11, Anssi Saari wrote: > Grant Edwards writes: > >> C wasn't very widely used under VMS, and VMS had it's own screen >> formatting and form handling libraries. > > Just curious, what language was widely used in VMS? >From what I remember, F

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
On 2011-03-11, Dennis Lee Bieber wrote: > On Fri, 11 Mar 2011 11:17:08 +0200, Anssi Saari declaimed > the following in gmane.comp.python.general: > >> Grant Edwards writes: >> >> > C wasn't very widely used under VMS, and VMS had it's own screen >

Re: Purely historic question: VT200 text graphic programming

2011-03-11 Thread Grant Edwards
moving second hand on a 240. Comparing a vt220 to a vt240 is like comparing a black-and-white epson 9-pin dot-matrix printer that can't do graphics with a balck-and-white epson 9-pin dot-matrix printer than can do graphics. -- Grant Edwards grant.b.edwa

Re: Purely historic question: VT200 text graphic programming

2011-03-12 Thread Grant Edwards
On 2011-03-12, Martin Gregorie wrote: > Sorry if I wasn't clear: I was intending to compare APIs rather than the > display mechanisms - I am aware that both text terminals and vector > graphics terminals are raster devices, not vector like oscilloscopes. > What I was getting at is that the AP

Re: attach to process by pid?

2011-03-12 Thread Grant Edwards
On 2011-03-12, John Nagle wrote: > On 3/9/2011 5:38 PM, Miki Tebeka wrote: >>> Is there any way to attach to an already running process by pid? I >>> want to send commands from python to an application that is already >>> running. I don't want to give the command name to >>> subprocess.Popen. >> W

Re: Purely historic question: VT200 text graphic programming

2011-03-12 Thread Grant Edwards
On 2011-03-12, Martin Gregorie wrote: > On Sat, 12 Mar 2011 17:11:37 +0000, Grant Edwards wrote: > >> The point I was trying to make was that the 240 was a >> superset of the 220, and could be used identically as the 220 was used. >> > Fair enough: I bow to hands-on

Re: Get Path of current Script

2011-03-14 Thread Grant Edwards
x world, finding out the path to the running program is almost always the wrong way to solve the problem. However, since we don't know the problem that's being solved, it's hard to suggest the "right" way to solve it. -- Grant Edwards g

Re: Get Path of current Script

2011-03-14 Thread Grant Edwards
sr/local/etc/muyprog.conf or something like that. Notice that it has nothing to do with the location of the program's executable. Not all Unix apps look in all 5 places (#2, is probably not quite as universal as the rest). Some apps have a directory of config files

Re: value of pi and 22/7

2011-03-18 Thread Grant Edwards
i=3. End Of. There's nothing wrong with that value. The measurements were given with one significant digit, so the ratio of the two measurements should only have one significant digit. -- Grant Edwards grant.b.edwardsYow! It's some people

Re: Directly Executable Files in Python

2011-03-29 Thread Grant Edwards
#x27;t buy it... Then don't. > it has to be reproducing the byte code interpreter in the code > segment and the byte code in the data segment... Something like that. -- Grant Edwards grant.b.edwardsYow! Either CONFESS now or

Re: Spam on the mailing list

2011-04-07 Thread Grant Edwards
er filtering out stuff and in part to my .score file entry that automatically discards anything posted via groups.google.com. -- Grant Edwards grant.b.edwardsYow! Do you have exactly at what I want in a plaid

Re: Argument of the bool function

2011-04-09 Thread Grant Edwards
On 2011-04-09, Lie Ryan wrote: > On 04/09/11 08:59, candide wrote: >> Le 09/04/2011 00:03, Ethan Furman a ?crit : >> >>> > bool([x]) >> dir([object]) >> Not very meaningful, isn't it ? > > The error says it unambiguously, dir() does not take *keyword* > arguments; instead dir() takes *position

Re: Feature suggestion -- return if true

2011-04-11 Thread Grant Edwards
On 2011-04-12, James Mills wrote: > On Tue, Apr 12, 2011 at 9:17 AM, zildjohn01 wrote: >> This is an idea I've had bouncing around in my head for a long time >> now. I propose the following syntax: > > Maybe this is more appropriare for the python-ideas list ? > >> ?? ??return? expr > > This synt

Re: Feature suggestion -- return if true

2011-04-11 Thread Grant Edwards
On 2011-04-12, James Mills wrote: > On Tue, Apr 12, 2011 at 11:44 AM, Grant Edwards > wrote: >> How is that the same? >> >> ??return? something() ?? ?? ?? ?? ?? ?? ?? ?? ??return something() or None >> ??return? somethingelse() ?? ?? ?? ?? ?? ?? ??return somethinge

Re: Feature suggestion -- return if true

2011-04-12 Thread Grant Edwards
On 2011-04-12, James Mills wrote: > On Tue, Apr 12, 2011 at 12:18 PM, Grant Edwards > wrote: >> You stated that >> >> ??return? >> >> was equivalent to >> >> ??return or None > > This is _not_ what I said. > > Quoting from my earli

Re: Feature suggestion -- return if true

2011-04-12 Thread Grant Edwards
does not return if expr is false. What you proposed returns None when expr is false. -- Grant Edwards grant.b.edwardsYow! Well, I'm INVISIBLE at AGAIN ... I might as well

Re: Feature suggestion -- return if true

2011-04-12 Thread Grant Edwards
# these two lines are ... if __temp__: return __temp__ # the OP's code snippet ... print "the code snippet did not return" ... >>> print foo(9) 9 >>> >>> print foo(0) the code snippet did not return None

Re: Egos, heartlessness, and limitations

2011-04-14 Thread Grant Edwards
On 2011-04-14, rantingrick wrote: > [the usual bait] One has to congratulate RR on how many fish he catches. I guess we should just be glad that in this electronic ocean overfishing doesn't cause a population crash. -- Grant Edwards grant.b.edwardsYow! Everyb

Re: An unusual question...

2011-04-18 Thread Grant Edwards
stion I have had for a while; when is PSF going > to forward PythonX on over to a formal standards committee like ansi or iso? Oh please no. Anything but that. Seriously. -- Grant Edwards grant.b.edwardsYow! Hmmm ... an arrogant

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Grant Edwards
it, but there isn't an 'xor' operator to go along with 'or' and 'and'. Must not be something I need very often. -- Grant Edwards grant.b.edwardsYow! I am having FUN... at I wonder if it's

Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
ives UDP broadcast packets regardless of their source IP address? This probably is more of a Linux networking question than a Python question, but I'm hoping somebody has solved this problem in Python. -- Grant Edwards grant.b.edwardsYow! I want

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Irmen de Jong wrote: > On 20-4-2011 0:21, Grant Edwards wrote: >> I'm have problems figuring out how to receive UDP broadcast packets on >> Linux. >> > [...] > >> Here's the sending code: >> >> -

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Irmen de Jong wrote: > On 20-4-2011 1:21, Grant Edwards wrote: >> >> If I don't call bind(), then the broadcast packets go out the wrong >> interface on the sending machine. > > Fair enough. > > Next issue then: as far as I know, broadca

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Dan Stromberg wrote: > On Tue, Apr 19, 2011 at 3:21 PM, Grant Edwards > wrote: >> I'm have problems figuring out how to receive UDP broadcast packets on >> Linux. >> >> Here's the receiving code: >&g

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-19, Dan Stromberg wrote: > On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong wrote: >> On 20-4-2011 1:21, Grant Edwards wrote: >>> >>> If I don't call bind(), then the broadcast packets go out the wrong >>> interface on the sending machine. >

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-20, Chris Angelico wrote: > On Wed, Apr 20, 2011 at 10:09 AM, Grant Edwards > wrote: >> The management program can then send another broadcast packet to >> configure the IP address of a device. After that, the management >> program switches over to no

Re: Problem receiving UDP broadcast packets.

2011-04-19 Thread Grant Edwards
On 2011-04-20, Chris Angelico wrote: > On Wed, Apr 20, 2011 at 11:15 AM, Grant Edwards > wrote: >>> Or can you simply use a stupid netmask like /1 that picks up all the >>> IP ranges? That way, the source-IP check wouldn't fail. >> >> That would requir

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
; popping the network adapter into promiscuous mode. In fact, it Might > be necessary irrespective of the rest of your approach. The network adapter is already receiving all the packets I want to receive, so putting it into promiscuous mode would only increase the number of

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Roy Smith wrote: > In article , > Grant Edwards wrote: > >> I'm trying to implement a device discovery/configuration protocol that >> uses UDP broadcast packets to discover specific types of devices on >> the local Ethernet segment. The

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Heiko Wundram wrote: > Am 20.04.2011 01:54, schrieb Grant Edwards: >> I guess the problem is that I expected to receive a packet on an >> interface anytime a packet was received with a destination IP address >> that matched that of the the interface. A

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Dan Stromberg wrote: > On Tue, Apr 19, 2011 at 6:15 PM, Grant Edwards > wrote: > >>> Or can you simply use a stupid netmask like /1 that picks up all the >>> IP ranges? That way, the source-IP check wouldn't fail. >> >> That would req

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Thomas Heller wrote: > Am 20.04.2011 00:21, schrieb Grant Edwards: >> I'm have problems figuring out how to receive UDP broadcast packets on >> Linux. > [...] >> >> On the receiving machine, I've used tcpdump to verify that broadcast >>

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Heiko Wundram wrote: > Am 20.04.2011 16:30, schrieb Grant Edwards: >>> If you need to see the packets regardless, either use a promiscuous mode >>> sniffer (i.e., tcpdump, but that's relatively easy to mirror in Python >>> using SOCK_RAW, capt

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Grant Edwards wrote: > On 2011-04-20, Heiko Wundram wrote: >>> I've thought about the SOCK_RAW option, but the CPU load of looking >>> all received Ethernet packets in user-space would be a big down-side. >> >> Not necessarily: instead o

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Adam Tauno Williams wrote: > On Wed, 2011-04-20 at 06:07 -0400, Sherm Pendley wrote: >> Grant Edwards writes: >> > I'm trying to implement a device discovery/configuration protocol that >> > uses UDP broadcast packets to discover specific ty

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
it didn't make any differnce. -- Grant Edwards grant.b.edwardsYow! My EARS are GONE!! at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-20, Grant Edwards wrote: > On 2011-04-20, Heiko Wundram wrote: >> Am 20.04.2011 01:54, schrieb Grant Edwards: >>> I guess the problem is that I expected to receive a packet on an >>> interface anytime a packet was received with a destination IP address >&

Re: Problem receiving UDP broadcast packets.

2011-04-20 Thread Grant Edwards
On 2011-04-19, Grant Edwards wrote: > I'm have problems figuring out how to receive UDP broadcast packets on > Linux. Thanks to everybody for their help with what turned out to have little or nothing to do with Python itself. The main problem was reverse-path filtering (which is

Re: Problem receiving UDP broadcast packets.

2011-04-21 Thread Grant Edwards
On 2011-04-21, Dan Stromberg wrote: > On Wed, Apr 20, 2011 at 7:21 AM, Grant Edwards > wrote: >> On 2011-04-20, Dan Stromberg wrote: >>> On Tue, Apr 19, 2011 at 8:12 PM, Dan Stromberg wrote: >>>> I agree though that you're kind of pushing IP in a d

Re: NaN

2011-04-28 Thread Grant Edwards
sensors return a NaN when the value is unkown/invalid it seemed logical to continue with that paradigm in my Python code -- and it pretty much "just works". -- Grant Edwards grant.b.edwardsYow! If elected, Zippy

Re: NaN

2011-04-28 Thread Grant Edwards
x27;s in a float is a NaN, so all 9's in a BCD value is a NaN. Sort of makes sense if the BCD operations propogate "all-nine" values or raise exceptions when they are encountered (that's a big if). -- Grant Edwards grant.b.edwardsYow! If elected, Zippy

Re: What other languages use the same data model as Python?

2011-05-02 Thread Grant Edwards
On 2011-05-02, Jorgen Grahn wrote: > On Sun, 2011-05-01, Terry Reedy wrote: >> On 5/1/2011 4:45 AM, Steven D'Aprano wrote: > ... >>> What other languages use the same, or mostly similar, data model as >>> Python? >> >> Natural languages. That is why I think it is better to think of Python >> as a

Re: What other languages use the same data model as Python?

2011-05-03 Thread Grant Edwards
ather like a macro language (e.g. cpp) which merely performs a textual substitution of the argument name (the difference between pass-by-name and macro substitution is that the context of the argument evaluation is different). -- Grant Edwards grant.b.edwards

Re: What other languages use the same data model as Python?

2011-05-03 Thread Grant Edwards
topic, > actually.) It's not so wrong to think of Python's parameter handling as > ordinary assignments from outer namespaces to an inner namespace. As long as you think of "ordinary assignments" the Python way and not the C or PL/I way. :) -- Grant Edward

Re: vertical ordering of functions

2011-05-03 Thread Grant Edwards
On 2011-05-03, Jabba Laci wrote: > I'm just reading Robert M. Martin's book entitled "Clean Code". In Ch. > 5 he says that a function that is called should be below a function > that does the calling. This creates a nice flow down from top to > bottom. I generally expect the opposite: callees ab

Re: Basic interaction with another program

2011-05-04 Thread Grant Edwards
going to do the OP much good. Quoting from the web page: "Pexpect does not currently work on the standard Windows Python" > http://www.noah.org/wiki/pexpect Seriously? Yellow on brown text? -- Grant Edwards grant.b.edwardsYow! When this load is

Re: Basic interaction with another program

2011-05-04 Thread Grant Edwards
On 2011-05-04, Ian Kelly wrote: > On Wed, May 4, 2011 at 10:52 AM, Grant Edwards > wrote: >> On 2011-05-04, Matty Sarro wrote: >>> On Wed, May 4, 2011 at 12:34 PM, ETP wrote: >>>> I have a dos program (run in a window) that I would like to control >>

<    1   2   3   4   5   6   7   8   9   10   >