problem with bcd and a number

2011-08-04 Thread nephish
Hey all, I have been trying to get my head around how to do something, but i am missing how to pull it off. I am reading a packet from a radio over a serial port. i have " two bytes containing the value i need. The first byte is the LSB, second is MSB. Both bytes are BCD-encoded, with the LSB c

problem with bcd and a number

2011-08-04 Thread nephish
Hey all, I have been trying to get my head around how to do something, but i am missing how to pull it off. I am reading a packet from a radio over a serial port. i have " two bytes containing the value i need. The first byte is the LSB, second is MSB. Both bytes are BCD-encoded, with the LSB c

Re: time challenge

2005-09-23 Thread nephish
sorry about that, i got a message in my inbox that said that the post was rejected so i tried it from my email client. wont happen again. shawn -- http://mail.python.org/mailman/listinfo/python-list

never mind about the plot stuff, my mistake

2005-09-26 Thread nephish
hey, a little update. i got the pychart working the examples did not include the necessary #!/usr/bin/python its like being a literary critic forgetting how to spell his name. thanks for your help getting the deb package going. i should be all good now. sk -- http://mail.python.org/mailman/list

another time challenge

2005-09-28 Thread nephish
Hey there pythoneers i have another question about time, specifically, the mxDateTime module. i have been able to get a RelativeDateTimeDiff between two times, it gives me a difference between two DateTimes in the form of +3days +2hours etc... so, if i have a date that is 6 days and 6 hours from

Re: another time challenge

2005-09-29 Thread nephish
cool, thanks -shawn -- http://mail.python.org/mailman/listinfo/python-list

question about smtplib

2005-10-03 Thread nephish
Hey there, i am using the smtplib module in python 2.3 my question is, this works: server = smtplib.SMTP(localhost) then server.sendmail(to address, from address, message) what i want to know is, how does the connection work? when i do server.sendmail, does it connect then ? or did it connec

Re: question about smtplib

2005-10-03 Thread nephish
cool. so this line server = smtplib.SMTP(localhost) is when i connect ? i had my syntax wrong anyway, i was using server.close() instead of server.quit() thanks much -- http://mail.python.org/mailman/listinfo/python-list

Re: question about smtplib

2005-10-04 Thread nephish
thanks for all the help, got it working ok now, connecting once, sending many. thanks for the link too. cheers, sk -- http://mail.python.org/mailman/listinfo/python-list

need some advice on x y plot

2005-10-20 Thread nephish
Hey there, i have tried about every graphing package for python i can get to work on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get matplot to work) so far, they all are working ok. I need to make an x y chart for some data that comes in from sensors at different times durring the d

Re: need some advice on x y plot

2005-10-20 Thread nephish
how ? i have tried to use unix timestamps, and i have also tried with DateTime objects do i need to use a scale that isn't linear (default in most) ? how do i putt this off ? thanks btw. sk -- http://mail.python.org/mailman/listinfo/python-list

Re: need some advice on x y plot

2005-10-20 Thread nephish
i have thought about doing this, just a little different. i was going to list the value pairs. take the start time and end time and plot 100 empty plots between them. add the value pairs, sort by time, and then draw it. The only thing is it get kinda complicated when the times change a lot. they co

Re: need some advice on x y plot

2005-10-20 Thread nephish
ok, yeah, thats exactly what i am looking for. i will give it a go. thanks a whole lot. putt this off is a typo, pull this off is what i was meaning to type. this is cool. -- http://mail.python.org/mailman/listinfo/python-list

Re: need some advice on x y plot

2005-10-21 Thread nephish
ok, i tried something similar to what you posted. a little simpler though. i am running a query on a database and making a list of time, value pairs kinda like this plot_points = ([time, value], [time, value], [time, value]) gnuplot complains that it needs a float for one of the values. i can plot

Re: need some advice on x y plot

2005-10-21 Thread nephish
the time is DateTime.DateTime object from a mySQLdb query. the value is a number anywhere between 0 and 15. the datetime is formatted like 2005-10-20 08:40:34 i could strip it and make a timestamp out of it. but reading the number of seconds since january of 1970 doesn't make a neat chart. any su

Re: need some advice on x y plot

2005-10-21 Thread nephish
ok, i have a display, and its a work in progress. lemme get this straight. you used gp('set term png') is this an example of sending normal gnuplot commands? if so, are all of the gnuplot commands available ? thanks so much this is helping me out a lot here -- http://mail.python.org/mailman/li

Re: need some advice on x y plot

2005-10-21 Thread nephish
this is great, because the docs on gnuplots website are a bit easier for me to grasp. thanks so much for your time on this one. you really have helped me a lot. i will not get a change to work on this till monday. so i may have more questions then. This is sure a point in the right direction. than

Re: need some advice on x y plot

2005-10-24 Thread nephish
ok, i am stuck a bit here with this line gp('set xtics (%s)' % ','.join(ticstrings)) the error code says that it is looking for a closing parenthesis. that and i am kinda new enough not to really get what %s is all about. i know it formats a string. can you simply pass a list to 'set xtics' ? i

Re: need some advice on x y plot

2005-10-25 Thread nephish
well, for what i tried, ticstrings just contained a list of times formatted like [10-21 09:15, 10-21 09:44, 10-21 09:59, and so on.] i did write mine a little different than the example that Grant gave me because its a little different application of time. i think i am having trouble knowing e

Re: need some advice on x y plot

2005-10-25 Thread nephish
Ok, first off, thanks for all the help guys, this part " set xtics ("label" pos, "label" pos, "label" pos) " is mainly what i was confused about. the 'pos' part. i think that the way i am writing this leaves this out. in fact, i am pretty sure. here is the code i am trying out. def draw_chart(s

Re: need some advice on x y plot

2005-10-25 Thread nephish
tics.append('"%s" %s' % (time.strftime(...), x)) # might need time.localtime(x) for that last term. ok, tried this and it worked. but the first plot is at the last plot of data back to that math mistake i mentioned earlier. so, thanks much, i will be back when i mess around with it some m

Re: need some advice on x y plot

2005-10-25 Thread nephish
WE DID IT ! little more tinkering and correcting this diff = start_time - end_time (vrs the other way around) and its working. so many thanks gents, a lot ! -- http://mail.python.org/mailman/listinfo/python-list

how do i run another script from my python script

2005-10-27 Thread nephish
hey there all, i have been looking for a way to run a php command line script from my python script. here is what i want to do: if x = 4: execute php4 testin.php else: execute php4 testout.php and i also need the script to wait untill the php4 script is done (which i think is the default

Re: how do i run another script from my python script

2005-10-27 Thread nephish
man, thats just too easy. thanks much ! -- http://mail.python.org/mailman/listinfo/python-list

Re: how do i run another script from my python script

2005-10-27 Thread nephish
well i know i dont want to do another thread, my program has six running all the time. whew. that can get nuts. i mean, this will come to me easier later i am sure. But right now. simple is best. thanks for all the suggestions, gents. right now i am just doing a varient of Steves suggestion, an

need start point for getting html info from web

2005-10-30 Thread nephish
hey there, i have a small app that i am going to need to get information from a few tables on different websites. i have looked at urllib and httplib. the sites i need to get data from mostly have this data in tables. So that, i think would make it easier. Anyone suggest a good starting point for

Re: need start point for getting html info from web

2005-10-30 Thread nephish
yeah, i know i am going to have to write a bunch of stuff because the values i want to get come from several different sites. ah-well, just wanting to know the easiest way to learn how to get started. i will check into beautiful soup, i think i have heard it referred to before. thanks shawn -- ht

question about urllib and parsing a page

2005-11-02 Thread nephish
hey there, i am using beautiful soup to parse a few pages (screen scraping) easy stuff. the issue i am having is with one particular web page that uses a javascript to display some numbers in tables. now if i open the file in mozilla and "save as" i get the numbers in the source. cool. but i click

Re: question about urllib and parsing a page

2005-11-02 Thread nephish
thats cool, but i want to do this automatically with python. what can i do to have urllib download the source with the numbers in it? ok, not necessarily urllib, whatever one is best for the occation thanks shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: question about urllib and parsing a page

2005-11-02 Thread nephish
well, i think thats the case, looking at the code, there is a long string of math functions in page, java math functions. h. i guess i'm up that famous creek. thanks for the info, though shawn -- http://mail.python.org/mailman/listinfo/python-list

need help extracting data from a text file

2005-11-07 Thread nephish
Hey there, i have a text file with a bunch of values scattered throughout it. i am needing to pull out a value that is in parenthesis right after a certain word, like the first time the word 'foo' is found, retrieve the values in the next set of parenthesis (bar) and it would return 'bar' i think

Re: need help extracting data from a text file

2005-11-07 Thread nephish
this is cool, it is only going to run about 10 times a day, the text is not written out like foo(bar) its more like foo blah blah blah (bar) the thing is , every few days the structure of the textfile may change, one of the reasons i wanted to avoid the re. thanks for the tip, -- http://mail.p

Re: need help extracting data from a text file

2005-11-07 Thread nephish
um, wait. what you are doing here is easier than what i was doing after your first post. thanks a lot. this is going to work out ok. thanks again. sk -- http://mail.python.org/mailman/listinfo/python-list

question about extracting value from a string

2005-12-07 Thread nephish
hey there, i have looked at the string module and re. i was looking for advice on what would be the best way to pull a value out of a small string. for example, i have a string $.+.09 JAR and all i want out of it is the +.09 likewise, i have $-.04 TIN kt and all i want is the -.04 what wou

Re: question about extracting value from a string

2005-12-07 Thread nephish
the second line was not a typo , and thanks for that. these values may vary somewhat over time. So i may have to rewrite this part of the script. a string is fine for right now, because it is just going to be pumped into a database. i can change it later if necessary. thanks for the help gents, i

Re: question about extracting value from a string

2005-12-07 Thread nephish
>I agree -- "to each day are sufficient the evils thereof". Many >programmers fall into the temptation to overgeneralize and fail to >follow the AGNI principle ("Ain't Gonna Need It"...;-). thats funny :) -- http://mail.python.org/mailman/listinfo/python-list

need to strip stuff off email

2005-06-21 Thread nephish
hey there, i have a script that retrieves my email, but i need it to be able to strip all the stuff off except the body (the message itself) so i can later write it to a text file. anyone know how to accomplish this? thanks -- http://mail.python.org/mailman/listinfo/python-list

some trouble with MySQLdb

2005-06-29 Thread nephish
Hey there all, i have a question about how to point my python install to my sql database. when i enter this: db = MySQLdb.connect(user="user", passwd="pass", db="myDB") i get this: Traceback (most recent call last): File "", line 1, in -toplevel- db = MySQLdb.connect(user="user", passwd="p

need help with MySQLdb

2005-06-29 Thread nephish
Hey there all, i have a question about how to point my python install to my sql database. when i enter this: db = MySQLdb.connect(user="user", passwd="pass", db="myDB") i get this: Traceback (most recent call last): File "", line 1, in -toplevel- db = MySQLdb.connect(user="user", passwd="pa

need to get an index for an item in a list

2005-07-03 Thread nephish
hey there, i need to be able to get the index for an item in a list. the list is a list of lines read from a text file. like this: file = open("/home/somefile.text", "r") lines = file.readlines() file.close() now, i want to see if a certain string is == to one of the lines and if so, i need to k

Re: need to get an index for an item in a list

2005-07-03 Thread nephish
Hey, thanks, this has worked out for me. i am trying to do as much of this as possible in IDLE because it lets me know on the fly what is messed up. thanks for your help shawn <>< -- http://mail.python.org/mailman/listinfo/python-list

how to write a line in a text file

2005-07-25 Thread nephish
Hey there, kinda newbie question here. i know how to read the lines of a txt file. i know how to write a txt file. but how do i overwrite a line value with another value ? i mean, how do go to, say, line 3 of a text file and replace what is written on line 3 with something else? thanks <>< --

Re: how to write a line in a text file

2005-07-25 Thread nephish
Gee whiz, so easy. thanks. Never thought about just changing it while it was read then re-writing it. that will be just fine. these files are only 9 lines long. thanks again ! -- http://mail.python.org/mailman/listinfo/python-list

need some info on MySQL module.

2005-07-26 Thread nephish
Hey there, does anyone know where i can find some real documentation on the MySQLdb module? This thing is driving me nuts. all i can find on the internet is some brief tutorials. I need to know whats up with some of my stuff i even bought Programming Python by O'Reilly, out of over 1200 pages, and

Re: need some info on MySQL module.

2005-07-26 Thread nephish
Wow, thanks so much. I promise, i didn't know that was out there. should help me out a lot. still a newbie here, somewhat. thanks again <>< -- http://mail.python.org/mailman/listinfo/python-list

question about deleting records from mysql

2005-07-27 Thread nephish
Hey there, sorry , second question in as many days. i am trying to do some stuff with MySQLdb and the thing is, i can select records and such, but when i try to delete them, they dont really go away. like this >>> cursor.execute("DELETE FROM table WHERE autoinc > 1000") 240L >>> cursor.execute("S

Re: question about deleting records from mysql

2005-07-27 Thread nephish
Simon Brunning wrote: >On 27 Jul 2005 04:29:33 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>Hey there, >>sorry , second question in as many days. >>i am trying to do some stuff with MySQLdb and the thing is, i can >>select records and such, but when i try to delete them, they dont >

Re: question about deleting records from mysql

2005-07-27 Thread nephish
ok. did this >>> cursor.execute("DELETE FROM table WHERE autoinc > 1000") 245L >>> cursor.commit() i got an AttributeError 'Cursor' object has no attribute 'commit' hmm. what should i do now? the stuff about writing a lightweight layer between the dbapi and the program shot right over my head. s

Re: question about deleting records from mysql

2005-07-27 Thread nephish
Man, thanks for the link. and the tip. i am testing the db.commit() and printing the doc right now. thanks again. On 07/27/2005 07:43:24 AM, Rowdy wrote: > [EMAIL PROTECTED] wrote: >> ok. did this >> >> > cursor.execute("DELETE FROM table WHERE autoinc > 1000") >> >> 245L >> > cursor.

easy float question just eludes me

2005-07-28 Thread nephish
Hullo all ! i have a real easy one here that isn't in my book. i have a int number that i want to divide by 100 and display to two decimal places. like this float(int(Var)/100) but i need it to display the .00 even if it does not have a .00 value like this if Var is 50, i need to display .50 inst

Re: easy float question just eludes me

2005-07-28 Thread nephish
way cool, outta work out just fine On 07/28/2005 08:48:27 AM, Simon Brunning wrote: > On 28 Jul 2005 06:39:32 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > i have a real easy one here that isn't in my book. > > i have a int number that i want to divide by 100 and display to two > > dec

Re: easy float question just eludes me

2005-07-28 Thread nephish
oops, i dont seem to have a module decimal -shawn On 07/28/2005 08:48:27 AM, Simon Brunning wrote: > On 28 Jul 2005 06:39:32 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > i have a real easy one here that isn't in my book. > > i have a int number that i want to divide by 100 and display

getting an empty tuple

2005-07-31 Thread nephish
Hey there, i have a simple database query that returns as a tuple the number of rows that the query selected. kinda like this >>> cursor.execute('select value from table where autoinc > 234') >>> x = cursor.fetchall() >>> print x >>> 21L ok, means 21 rows met the criteria of the query. but if th

Re: getting an empty tuple

2005-07-31 Thread nephish
ok, this is what works: if x == (): sorry about the bad info. and what i ment to put was x[0] not x(0) thanks for the tips its all good now shawn Steven D'Aprano wrote: > On Sun, 31 Jul 2005 08:40:26 -0700, nephish wrote: > > > Hey there, > > i have a simple database

Re: GUI programming, embedding, real time plots, etc.

2005-08-05 Thread nephish
apt-get install python-pwm this will get you python mega widgets one of the dependencies that apt will take care of for you is the python2.whatever-tk. depending on which version of debian you are using. i run sarge with python 2.3 -- http://mail.python.org/mailman/listinfo/python-list

question about binary and serial info

2005-08-17 Thread nephish
i have an interesting project at work going on. here is the challenge. i am using the serial module to read data from a serial input. it comes in as a hex. i need to make it a binary and compare it bit by bit to another byte. They have some weird way they set this up that i have to compare these th

Re: question about binary and serial info

2005-08-17 Thread nephish
yeah, i think i got that down, i need help with getting the hex to binary, then splitting the byte up to compare each bit against the bit in another byte. unless i am not understanding this stuff with the bitwise right. there wasn't a lot in the python library reference about it. thanks -- http:/

Re: question about binary and serial info

2005-08-18 Thread nephish
this is exactly what i need. i have not previously had a need for this kind of thing, but i sure need some documentation for it now. is there a resource out there to find out how to convert decimal number to a byte, a byte to a decimal and more about the & operator? i really appreciate this info. t

Re: question about binary and serial info

2005-08-18 Thread nephish
oh wait, i found it. i found how to do the conversions and thanks to you the operators. appreciate everything, shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: question about binary and serial info

2005-08-18 Thread nephish
i got the bitwise part, i just cant seem to convert the incomming ascii into hex, binary, integer, or decimal. how do i do this, my serial port bytes just come in all weird looking ascii characters thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: question about binary and serial info

2005-08-18 Thread nephish
i have an ascii string comming in the serial port and i need to convert it to something else, like an integer, or binary, or even a hex so i can use the bitwise comparison on it. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: question about binary and serial info

2005-08-18 Thread nephish
>>> import serial >>> ser = serial.Serial('/dev/ttyS0', 2400, timeout= 10, bytesize=8, stopbits=1) >>> a = ser.read(1) >>> print a ^ >>> ser.close() >>> type(a) >>> int(a, 16) Traceback (innermost last): File "", line 1, in ? ValueError: invalid literal for int(): ^ so i run it again the same

Re: question about binary and serial info

2005-08-18 Thread nephish
all apologies, gentlemen, i feel like an idiot. the ord() is what is returning what i need. the manufacturer of the unit i am reading from told me that it puts out a "string that represents a hex" been thumping my head. sorry for the confusion, and thanks for your help shawn -- http://mail.pytho

Re: question about binary and serial info

2005-08-18 Thread nephish
thanks for your time. i have started just doing a type(a) from idle a lot just so i can make sure of what i am dealing with ( i do this a lot) before i build the .py file. got tired of 'cannot concatonate str and init' stuff all the time. this has been a wild project. nothing like getting in way ov

Re: question about binary and serial info

2005-08-21 Thread nephish
Sorry i am late getting back on this. ord() is finally what is giving me what i wanted. the vendor told me that what was comming in was an ascii string representing hex characters. So i expected when i used the serial module that what i would be getting was something along the lines of 4A, 3D, etc.

need a little help with time

2005-08-26 Thread nephish
Hey there. i have a time string (created with strftime) then read from a file, i am having some trouble understanding how to get the difference between times. i know i can structime(timestring) and get a time value, but i dont know how to manipulate it. basically, if i have string 2005-08-24 09:25

Re: need a little help with time

2005-08-26 Thread nephish
the mxDateTime thing should be great, i have to pass this stuff back and forth with MySQL DateTime fields, thanks a lot ! -- http://mail.python.org/mailman/listinfo/python-list

trouble with time --again

2005-08-30 Thread nephish
Hey there, could someone show me where i am going wrong here? >>> date1 = '2005-01-01 8:20:00' >>> date1 = strptime('%Y-%m-%d %H:%M:%S',date1) raise ValueError("time data did not match format: data=%s fmt=%s" % ValueError: time data did not match format: data=%Y-%m-%d%H:%M:%S fmt=2005-01-01 8:

Re: trouble with time --again

2005-08-30 Thread nephish
OH my god. youre right. i feel like a complete idiot. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble with time --again

2005-08-30 Thread nephish
he he. yep, just spent a lot of time on this one. life moves on. cheers! sk -- http://mail.python.org/mailman/listinfo/python-list

can i move attribute values from one class to another?

2005-09-07 Thread nephish
heres the deal. i am working on a threading gui. pygtk in one class (main) is all the gui stuff, but in another class that is a thread, i am reading serial input. what i want to be able to do is take what read in the thread and print it in a textview in the gui class. here is what i have: class

Re: can i move attribute values from one class to another?

2005-09-07 Thread nephish
oh wait. never mind , i figgured it out! thanks anyway -- http://mail.python.org/mailman/listinfo/python-list

need to divide a date

2005-09-22 Thread nephish
Hey there, i am doing a plotting application. i am using mxRelativeDateTimeDiff to get how much time is between date x and date y now what i need to do is divide that time by 20 to get 20 even time slots for plotting on a graph. For example, if the difference between them is 20 hours, i need 20 p

time challenge

2005-09-22 Thread nephish
Hey there, i am doing a plotting application. i am using mxRelativeDateTimeDiff to get how much time is between date x and date y now what i need to do is divide that time by 20 to get 20 even time slots for plotting on a graph. For example, if the difference between them is 20 hours, i need 20

check to see if value can be an integer instead of string

2006-01-17 Thread nephish
Hello there, i need a way to check to see if a certain value can be an integer. I have looked at is int(), but what is comming out is a string that may be an integer. i mean, it will be formatted as a string, but i need to know if it is possible to be expressed as an integer. like this var = some

Re: check to see if value can be an integer instead of string

2006-01-17 Thread nephish
thanks for the reply, but wont python fail out if you try to make an integer out of what cant be an integer? like this : var = int(abc) wont this crash ? -- http://mail.python.org/mailman/listinfo/python-list

Re: check to see if value can be an integer instead of string

2006-01-17 Thread nephish
this looks like the solution i am looking for. thanks for the education by the way. i have a couple of other try / except clauses. Never thought of pulling it off like that. thanks very much, really simple. -- http://mail.python.org/mailman/listinfo/python-list

Re: check to see if value can be an integer instead of string

2006-01-18 Thread nephish
it isn't really that i will want to change it to an integer anyway. the script uses a table to reference a value to a key, if the key is a group of letters, that code tells the script to do something. if the value is a number, it means an equipment failure. The thing is, all the values come out as

how to know if socket is still connected

2006-07-16 Thread nephish
lo there, i have a simple app that connects to a socket to get info from a server i looks like this serverhost = 'xxx.xxx.xxx.xxx' serverport = 9520 aeris_sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM) aeris_sockobj.connect((serverhost,serverport)) while 1: do this or that with

Re: how to know if socket is still connected

2006-07-16 Thread nephish
Grant Edwards wrote: > On 2006-07-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > serverhost = 'xxx.xxx.xxx.xxx' > > serverport = 9520 > > aeris_sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > aeris_sockobj.connect((serverhost,serverport)) > > > > while 1: > > do this or

Re: Cool Python Ebooks Site

2006-07-16 Thread nephish
are not most (or all) of these copywrite protected ? thats why i have not pulled some of them myself, you can get most of them used from amazon for about $10 [EMAIL PROTECTED] wrote: > http://cooldogebooks.blogspot.com/2006/05/python-ebooks.html > > Here is a cool site were you can preview python

Re: how to know if socket is still connected

2006-07-16 Thread nephish
cool enough, thanks ! -sk Grant Edwards wrote: > On 2006-07-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> If the server has closed the connection, then a recv() on the > >> socket will return an empty string "", and a send() on the > >> socket will raise an exception. > > > like this ?

Re: how to know if socket is still connected

2006-07-17 Thread nephish
hey there, i have a question about this solution. if i have a message = socket.recv() in the script, and the socket connection drops, will the socket.recv() just wait forever for something to come across the internet port? or will it know if the connection is dropped? thanks. -sk Grant Edwards wr

Re: how to know if socket is still connected

2006-07-17 Thread nephish
oh, sorry, what i mean by dropped is that the server i am connecting to can close the connection. If that happens, i need to know about it. i also need to know about it if the server i am connecting to just dies. if recv() returns "" is that the same as NONE ? again, sorry, i am still kinda new at

Re: how to know if socket is still connected

2006-07-17 Thread nephish
> If the server _application_ crashes or exits, then the OS will > close the socket and recv() will return "". If somebody powers > down the server without warning, or if the server OS crashes, > or if the Ethernet cable between the Internet and the server is > cut, then the socket will not be clo

Re: how to know if socket is still connected

2006-07-17 Thread nephish
ok, yeah, thats in my book. thanks, and no, it isn't enabled. thanks again for everything -sk Grant Edwards wrote: > On 2006-07-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> If the server _application_ crashes or exits, then the OS will > >> close the socket and recv() will return "". If

question about what lamda does

2006-07-17 Thread nephish
Hey there, i have been learning python for the past few months, but i can seem to get what exactly a lamda is for. What would i use a lamda for that i could not or would not use a def for ? Is there a notable difference ? I only ask because i see it in code samples on the internet and in books. th

Re: question about what lamda does

2006-07-18 Thread nephish
ok, i think i get it. pretty cool. thanks -sk Dan Bishop wrote: > [EMAIL PROTECTED] wrote: > > Hey there, > > i have been learning python for the past few months, but i can seem to > > get what exactly a lamda is for. > > It defines a function. > > f = lambda x, y: expression > > is equivalent to

Re: question about what lamda does

2006-07-18 Thread nephish
so a lamda needs to stay at one expression, and use more than one lamda for more expressions ? i think i get it. sk Nick Vatamaniuc wrote: > Use it anywhere a quick definition of a function is needed that can be > written as an expression. For example when a callback function is > needed you cou

Re: question about what lamda does

2006-07-20 Thread nephish
hey thanks for that last post, although some of it was a bit over my head. i think i am getting more of the differences here. thanks again, sk danielx wrote: > [EMAIL PROTECTED] wrote: > > Hey there, > > i have been learning python for the past few months, but i can seem to > > get what exactly a

prob with struct and byte order

2006-07-24 Thread nephish
hello there, all. i have a difficult app that connects to a server to get information for our database here. this server is our access point to some equipment in the field that we monitor. the messages come in over a socket connection. And according to their (very limited) documentation, are set

Re: prob with struct and byte order

2006-07-24 Thread nephish
ok, i did this print ' '.join(["%02.2x" % ord(b) for b in message]) and i got this in the text file 535458002c00ea31373538343636383535d6090d54454e58 so, yes, more of the info seems discernable now. according to their docs, all of their va

Re: prob with struct and byte order

2006-07-24 Thread nephish
ok. indeed i did do '' instead of ' '. here is an example of a message 'STX\x00\x00\x004\x00\x00\x00\xc8stateman\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00state1man\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ENX' tohex gave me '53 54 58 00 00 00 34 00 00 00 c8 70 6

Re: prob with struct and byte order

2006-07-25 Thread nephish
N(32); # this is the serial number of the unit unsigned long int ESN # serial number of the communicator unsigned long int userID thanks again guys.. i think we're getting closer. -sk John Machin wrote: > Marc 'BlackJack' Rintsch wrote: > > In <[EMAIL PROTECTE

easy question about join method

2006-08-06 Thread nephish
i have seen the join method before, mostly in this group and i want to get it a little better. if i have a list x = ['this','is','a','sentence','held','in','a','list'] how can i make it print as a single string? or make a single string out of it ? thanks -- http://mail.python.org/mailman/list

Re: easy question about join method

2006-08-06 Thread nephish
yep, easy enough thanks -shawn Jorge Godoy wrote: > "nephish" <[EMAIL PROTECTED]> writes: > > > i have seen the join method before, mostly in this group and i want to > > get it a little better. > > > > if i have a list > > >

Re: easy question about join method

2006-08-06 Thread nephish
very helpful indeed. i did a help([]) to see if it would give me anything for a list. wow. thanks a lot. -sk Terry Reedy wrote: > The easy way to get one answer for buildin funcs and methods is the help > function in the interactive interpreter (and Idle's and probably other > imitations thereof)

question about class, functions and scope

2006-08-26 Thread nephish
lo there all, i have an app that runs three classes as threads in the same program. some of them need to be able to share some functions. Can i set a function before i define a class and have the class use it ? Kinda like this. def some_function(var1, var2): do something with var1, var2 r

Re: question about class, functions and scope

2006-08-26 Thread nephish
[EMAIL PROTECTED] wrote: > nephish: > > is this legal ? is it pythonic? > > It's legan and pythonic. Functions are here for a purpose. > > Bye, > bearophile cool enough, and thanks for the quick reply. shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: question about class, functions and scope

2006-08-26 Thread nephish
nephish wrote: > [EMAIL PROTECTED] wrote: > > nephish: > > > is this legal ? is it pythonic? > > > > It's legan and pythonic. Functions are here for a purpose. > > > > Bye, > > bearophile > > cool enough, and thanks for the quick reply

  1   2   >