[Tutor] how to get variable from an external script or program

2009-05-29 Thread shawn bright
Hey all I have a small program that when run from the command line, will return a certain value for an arguement. Like this: > mfetchz 45 > 45j so the program is mfetchz and the argument is 45 i know i can call the program with os.system("mfetchz 45") but how do i get the return? The OS is lin

Re: [Tutor] how to get variable from an external script or program

2009-05-29 Thread shawn bright
kick butt, gents, thanks a lot sk On Fri, May 29, 2009 at 4:39 PM, W W wrote: > On Fri, May 29, 2009 at 4:27 PM, shawn bright wrote: >> >> Hey all >> >> I have a small program that when run from the command line, will >> return a certain value for an argueme

Re: [Tutor] how to get variable from an external script or program

2009-05-29 Thread shawn bright
cool, thanks again sk On Fri, May 29, 2009 at 5:09 PM, Alan Gauld wrote: > > "vince spicer" wrote >> >> import commands >> output = commands.getout("ls -lah") > > There are many ways to do this in Python including os.popen, commands and > subprocess. > > But subprocess is the "officially correct

[Tutor] how to know if process is running?

2009-07-28 Thread shawn bright
Hey all, I have an app that runs in a GUI written in pygtk. It spawns several threads, and runs all the time. It is mission critical that we can never have two instances of this running at once. So, my question is, how can i write something that will know if there is an instance of that something

Re: [Tutor] how to know if process is running?

2009-07-28 Thread shawn bright
Thanks for the pointers Wayne, Tino, Looks easier than i had thought. sk On Tue, Jul 28, 2009 at 11:10 AM, Tino Dai wrote: > On Tue, Jul 28, 2009 at 11:45 AM, shawn bright wrote: >> >> So, my question is, how can i write something that will know if there >> is an insta

Re: [Tutor] how to know if process is running?

2009-07-28 Thread shawn bright
n_pattern if you > watch at the sample implementation, there is a Python example too. > > Mac. > > On Tue, 2009-07-28 at 10:45 -0500, shawn bright wrote: >> Hey all, >> >> I have an app that runs in a GUI written in pygtk. It spawns several >> threads, and r

[Tutor] problem with socket connection

2009-12-21 Thread shawn bright
Hey all, I keep getting a connection error 111 connection refused. When i try to connect to a server at a remote ip address. I am using linux on both computers. the socket server looks like this: #!/usr/bin/python import SocketServer class MyTCPHandler(SocketServer.BaseRequestHandler): def

[Tutor] problem with socket connection

2009-12-21 Thread shawn bright
Hey all, I keep getting a connection error 111 connection refused. When i try to connect to a server at a remote ip address. I am using linux on both computers. the socket server looks like this: #!/usr/bin/python import SocketServer class MyTCPHandler(SocketServer.BaseRequestHandler): def

[Tutor] how to stop a function

2007-04-24 Thread shawn bright
hello all, i have a gui app that uses functions to respond to gui events. like def on_start_button_clicked(self, stuff): do this or that. now there is one function that i have a kinda nested if else conditions that i need to stop if necessary if value == 1: if next_val == 4: do t

Re: [Tutor] how to stop a function

2007-04-24 Thread shawn bright
jeeze, thanks, sorry, stupid question. On 4/24/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > shawn bright wrote: > > now there is one function that i have a kinda nested if else > > conditions that i need to stop if necessary > > > > if value == 1: > >

[Tutor] best way to tell if i am connected to the internet

2007-04-30 Thread shawn bright
hello there all, i am wondering, what would be the simplest way to get a true/false am i connected to the internet ? right now i am using httplib to fetch a webpage every 20 minutes to see, but i am thinking that there is a better way, any suggestions would be encouraging thanks shawn

Re: [Tutor] best way to tell if i am connected to the internet

2007-04-30 Thread shawn bright
ok, cool. thanks sk On 4/30/07, Jalil <[EMAIL PROTECTED]> wrote: ping a host on the net if you get an echo response back you are good. better yet ping the host page you are scraping. On 4/30/07, shawn bright < [EMAIL PROTECTED]> wrote: > > hello there all, > > i am

Re: [Tutor] best way to tell if i am connected to the internet

2007-05-01 Thread shawn bright
good enough, i suppose i can use a try, except to test if i am online and from that have a true / false. That is what i was looking for. I just didn't think it necessary to pull a webpage every 20 minutes. thanks shawn k On 5/1/07, Alan Gauld <[EMAIL PROTECTED]> wrote: "shawn

[Tutor] how to stop output to terminal

2007-05-10 Thread shawn bright
lo there all, i have a simple thread that i want to run without piping any output to the terminal. like if i do an x = os.system("ping -c 1 www.google.com") i don't want it to show all the stuff in the terminal. can i disable that ? can i disable it for only certain lines? thanks ___

Re: [Tutor] how to stop output to terminal

2007-05-11 Thread shawn bright
cool, thanks sk On 5/11/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: shawn bright wrote: > lo there all, > > i have a simple thread that i want to run without piping any output to > the terminal. > like if i do an > > x = os.system("ping -c 1 www.google.com

Re: [Tutor] easiest way to get true/false of odd/even number

2007-05-14 Thread shawn bright
nevermind, i found it. 4 %2 = 0 (even) 5 %2 = 1 (odd) pretty simple shawn On 5/14/07, shawn bright <[EMAIL PROTECTED]> wrote: Hey there all, i know this sounds kinda easy, but i was wanting the least verbose way to get a True / False of a number being odd (not even) thanks

[Tutor] easiest way to get true/false of odd/even number

2007-05-14 Thread shawn bright
Hey there all, i know this sounds kinda easy, but i was wanting the least verbose way to get a True / False of a number being odd (not even) thanks shawn ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python IDE

2007-06-11 Thread shawn bright
you can use gedit with some plugins that make it pretty much like an ide, and its really fast. another really cool one is JEdit. That is what i used before i switched to vim to do everything. runs on everything, has what you are looking for. Eclipse with PyDev is cool, too. But a little heavy for

[Tutor] cyclical redundancy check

2007-07-04 Thread shawn bright
Hello there all, Does anyone know where i can find a function that does an 8 bit Cyclical Redundancy Check. I need it to verify data, and i need to be able to create one given an 12 byte message. Does anyone know much about doing this in python ? thanks __

Re: [Tutor] cyclical redundancy check

2007-07-04 Thread shawn bright
wait, sorry, thats 16 bits total, a low byte and a high byte. If that makes more sense thanks On 7/4/07, shawn bright <[EMAIL PROTECTED]> wrote: Hello there all, Does anyone know where i can find a function that does an 8 bit Cyclical Redundancy Check. I need it to verify data, and i n

[Tutor] help with translating a c function to a python function

2007-07-05 Thread shawn bright
hello all, i have a c function from some modbus documentation that i need to translate into python. it looks like this: unsigned short CRC16(puchMsg, usDataLen) unsigned char *puchMsg ; unsigned short usDataLen ; { unsigned char uchCRCHi = 0xFF ; unsigned char uchCRCLo = 0xFF ; unsi

Re: [Tutor] help with translating a c function to a python function

2007-07-05 Thread shawn bright
< 8 | crc_lo) whaddya think? On 7/5/07, shawn bright <[EMAIL PROTECTED]> wrote: > hello all, > > i have a c function from some modbus documentation that i need to > translate into python. > > it looks like this: > > > unsigned short CRC16(puchMsg, usDataLen) >

Re: [Tutor] help with translating a c function to a python function

2007-07-05 Thread shawn bright
Thanks Alan, so do you think my translation is close? i do not know a lick of c. Nope, not one line. thanks shawn On 7/5/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "shawn bright" <[EMAIL PROTECTED]> wrote > while (usDataLen––) > { >

[Tutor] back on bytes

2007-07-06 Thread shawn bright
hello all, i have a number 12480 i have a low byte of 192 and a high byte of 176 so i can do this IDLE 1.2.1 No Subprocess >>> (176 & 127) * 256 + 192 12480 but if i start with the 12480, how do i get the two bytes (lo and hi) that make it up? i kinda know what i am doing here,

Re: [Tutor] back on bytes

2007-07-07 Thread shawn bright
Well, I contacted the programmer of these controls and the reason they mask the MSB on these reports is to designate what type of sensor it is. If the MSB is set, the sensor is one type, if not, another. So, knowing that i could put these together ok. To me, the speed is of no consequence like it w

Re: [Tutor] help with translating a c function to a python function

2007-07-08 Thread shawn bright
Hey thanks, i finally did get a function working. i posted it on www.bitsbam.com i did guess that the puchMsg++ ment that it was iterating through the bytes of an array. And Kent and Alan helped me get through the other parts. I am glad for all this help, because this is an issue that comes up i

[Tutor] storm anyone?

2007-07-11 Thread shawn bright
Hey there all, i got the news that storm was released as open source. Storm is a db orm for python. i have a downloaded package and i would like to play with it, but it does not come with any install instructions. i found the package here https://storm.canonical.com/FrontPage there is a makefile i

Re: [Tutor] How do you install EGG files

2007-07-18 Thread shawn bright
Hey thanks for this, yes, i used the easy_install method and it did work on the python 2.4, the python 2.5 failed. shawn On 7/18/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Terry Carroll wrote: > On Wed, 11 Jul 2007, shawn bright wrote: > >> Hey there all, >> i got

[Tutor] about importing a module

2007-07-19 Thread shawn bright
hello there, if i have a module that is in the same directory as the file that imports it, but that module has the same name as a module in my python path, which one gets imported ? i ask because i want to do some work on the module, but dont want to mess with my stable one in site-packages. so

Re: [Tutor] about importing a module

2007-07-19 Thread shawn bright
change the name of the module, simple. thanks shawn On 7/19/07, Tiger12506 <[EMAIL PROTECTED]> wrote: If the module has been imported before your code is run, it will be the library module (very important if working in IDLE which importants many modules, for example). But if it has not been imp

[Tutor] question about datetime object

2007-07-20 Thread shawn bright
Hello there, if i have a python datetime object, what is the easiest way to make it into epoch seconds ? thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] another question ( unrelated )

2007-07-20 Thread shawn bright
something is failing and how soon i could re-connect to the data server. whew ! thanks shawn On 7/20/07, Kent Johnson <[EMAIL PROTECTED]> wrote: shawn bright wrote: > If i have a thread, of type threading.Thread > that i initiate with an __init__ > in the > def run(sel

[Tutor] another question ( unrelated )

2007-07-20 Thread shawn bright
If i have a thread, of type threading.Thread that i initiate with an __init__ in the def run(self): while 1: do some stuff is there a way i can stop this thread and restart this thread from within itself ? thanks ___ Tutor maillist - Tu

[Tutor] how to sort a dictionary by values

2007-08-07 Thread shawn bright
hello there all, i am wondering how to sort a dictionary that i have by values. And i also need to sort them from greatest to least like if i have a dictionary d = {'a':21.3, 'b':32.8, 'c': 12.92} how could i sort these from least to greatest so that the order would turn out b,a,c thanks shawn _

Re: [Tutor] how to sort a dictionary by values

2007-08-08 Thread shawn bright
sorry all, i did mean greatest to least, thanks for all the help here shawn On 8/8/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Tiger12506 wrote: > >> Just curious: Is there a reason to use __getitem__() over itemgetter > (used > >> in the example in my reply)? > > > > __getitem__ is a method b

[Tutor] how to add arguments to a command line program

2007-09-14 Thread shawn bright
lo there all, i want to write a program that will be called from another program. I need to pass it one variable. i suppose i could also do this with a module, and create a new instance of whatever i want to pass it to, but all the same, how would i go about this. like if i had a program that i wa

Re: [Tutor] how to add arguments to a command line program

2007-09-14 Thread shawn bright
Just what i was looking for, thanks shawn On 9/14/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > "shawn bright" <[EMAIL PROTECTED]> wrote > > > i am sure i do it with sys args, but don't know how. > > > > like > > > > python

[Tutor] do i have to import modules at the start of a file?

2007-09-26 Thread shawn bright
lo there all, i have a gui program that imports a few modules that i don't need if i am using the program remotely. The program has an admin interface and thread interface, only the admin interface is needed when i am using the program from a remote computer. all of my modules are imported at the

Re: [Tutor] do i have to import modules at the start of a file?

2007-09-27 Thread shawn bright
n the admin part of the program. But the main computer at work that takes data in will need the modules to run the threads. thanks for your help on this shawn On 9/26/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > shawn bright wrote: > > lo there all, > > > > i ha

Re: [Tutor] internet access

2007-10-11 Thread shawn bright
i did something very similar to this. My daughter would stay on her instant messenger (gaim) all night if i didn't. i have a cron script that checks the hour of day, if later than x pm. does os.system("/etc/init.d/network stop") os.system("chmod a-x /etc/init.d/network") ( so that a reboot doesn't

[Tutor] need a way to get my own ip address

2008-01-02 Thread shawn bright
Greetings, i am looking for an easy way to get my own ip address as a string from python. I am using Ubuntu Linux if that makes any difference. thanks ! shawn ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] need a way to get my own ip address

2008-01-02 Thread shawn bright
name())[2] > > Jay > > On Jan 2, 2008 8:25 AM, shawn bright < [EMAIL PROTECTED]> wrote: > > > Greetings, > > > > i am looking for an easy way to get my own ip address as a string from > > python. > > I am using

Re: [Tutor] need a way to get my own ip address

2008-01-02 Thread shawn bright
nux/Unix system? What does this > return? > > print socket.gethostname() > print socket.gethostbyaddr(socket.gethostname ()) > > j > > > On Jan 2, 2008 8:45 AM, shawn bright <[EMAIL PROTECTED]> wrote: > > > Thanks, Jay, > > in IDLE, this gave me

Re: [Tutor] need a way to get my own ip address

2008-01-02 Thread shawn bright
nk I found on google > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/439094 > > jay > > > On Jan 2, 2008 9:00 AM, shawn bright <[EMAIL PROTECTED]> wrote: > > > It returns this > > ('hostname', [], [' 127.0.1.1']) > > i am ru

Re: [Tutor] question about a number and bytes.

2008-01-29 Thread shawn bright
Thanks for your reply. i need to do this in python because python is what scripting language our data I/O system is written in. i am writing a command out over a serial port that tells an RTU to change part of it's program. I am not sure what you mean by using it in any other python context, this i

[Tutor] question about a number and bytes.

2008-01-29 Thread shawn bright
Hello there all. I have a need to make a hi byte and lo byte out of a number. so, lets say i have a number 300, and need this number to be represented in two bytes, how do i go about that? thanks for any tips, sk ___ Tutor maillist - Tutor@python.or

Re: [Tutor] question about a number and bytes.

2008-01-29 Thread shawn bright
gt; The format string will depend whether you need little or big endian. > >--Michael > > > > On Jan 29, 2008 4:13 PM, shawn bright <[EMAIL PROTECTED]> wrote: > > Thanks for your reply. > > i need to do this in python because python is what scripting language

Re: [Tutor] MySQLdb question.

2006-07-28 Thread shawn bright
you may be missing db.commit(). When you do insert, update, etc.. you call commit() to make the changes stick.-skOn 7/28/06, Kent Johnson < [EMAIL PROTECTED]> wrote:Ron Phillips wrote:> I am trying to write a script that adds data to a table using > MySQLdb.py.  For some reason, "INSERT" seems to w

[Tutor] question about type str

2006-07-29 Thread shawn bright
Hey there,i have an app with this line.sys.stderr.write("GET DATA %s %d %d\n" (sound, time_limit, digit_count))it is failing with the following error.Traceback (most recent call last):   File "/usr/share/asterisk/agi-bin/ast_agi_test.agi", line 88, in ?    entered_digits = getNumber(welcome, ti

Re: [Tutor] question about type str

2006-07-29 Thread shawn bright
gee whiz, i thought i had poured over that line sufficiently.It works now. imagine that.thanks,shawnOn 7/29/06, Python < [EMAIL PROTECTED]> wrote:On Sat, 2006-07-29 at 09:26 -0500, shawn bright wrote: > Hey there,> i have an app with this line.> sys.stderr.write("GET DAT

[Tutor] problem with rejected mail smtplib

2006-07-29 Thread shawn bright
Hello there,i have a customer list, each with a number of email address that we send notifications to via text message.the problem is, there are a number of providers ( just two ) that reject our messages.the script goes a little something like this : Address = '[EMAIL PROTECTED]'From = '[EMAIL PRO

Re: [Tutor] problem with rejected mail smtplib

2006-07-30 Thread shawn bright
Oh, right... sorry... i didn't know i could do it like that. I was looping thru themfor address in addresses:    server.sendmail(from,address,message)i did not mention that in the OP.-shawn On 7/30/06, Michael P. Reilly <[EMAIL PROTECTED]> wrote: On 7/29/06, shawn bright <[EMAIL PROT

Re: [Tutor] The Self

2006-07-31 Thread shawn bright
Im not the OP, but this clears up some stuff for ma about "self". I thank you for your time to post this. -shawnOn 7/31/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Sebastian Smith wrote:> I am new to Python, real new. I am loving the language and learning> fast but I have hit a wall with the

[Tutor] question about headers and smtplib

2006-07-31 Thread shawn bright
Hey there, me again with another question about headers.. if i use my python script to send an email, it gets rejected by some providers. but another app that i use can send the same email and it gets thru. i have sent myself test messages from both apps and looked at the headers. the only differ

Re: [Tutor] question about headers and smtplib

2006-08-01 Thread shawn bright
OK, this worked, please disregard my last. The online docs at python.org told me the answer to that one. Between their example and yours, i am able to make it work. thanks a whole bunch ! shawnOn 7/31/06, Justin Ezequiel <[EMAIL PROTECTED]> wrote: When I first started with Python, I used MimeWrite

[Tutor] quick OO pointer

2006-08-06 Thread shawn bright
Hello there,a while back i wrote a module called DbConnector.py that allowed me to run different types of SQL queries. Cool enough.i did it mostly to handle the open and close of a db connection so i wouldn't have to worry about 'too many connection' errors. it makes a connection, runs a query, the

Re: [Tutor] quick OO pointer

2006-08-07 Thread shawn bright
Way cool, thanks a lot. I have one more small question.If my script that needs to call a function from another module, and the module itself both require, say, the string module do i need to import it in both?If i just import string on my original script, will the module know what to do with it

[Tutor] how to get an email attachment

2006-08-21 Thread shawn bright
lo there pythoneers !i have a simple script to pull some emails from a pop server.so far, its working. What i need to do is get an attachment. That attachment is going to be encoded in base 64.so, i am looking and i can't find how to get the attachment. I have some info on the base64 module, so i s

Re: [Tutor] Big wad of Python tutorials

2006-08-21 Thread shawn bright
way cool, thanks !-skOn 8/21/06, Carroll, Barry <[EMAIL PROTECTED]> wrote: > -Original Message-> Date: Mon, 21 Aug 2006 13:52:45 -0700 (PDT)> From: Terry Carroll <[EMAIL PROTECTED]>> Subject: [Tutor] Big wad of Python tutorials > To: tutor@python.org> Message-ID:>   <[EMAIL PROTECTED] >

Re: [Tutor] how to get an email attachment

2006-08-21 Thread shawn bright
forhandling mail attachments? Might be worth a look.Alan G.- Original Message -----From: "shawn bright" < [EMAIL PROTECTED]>To: "tutor-python" <tutor@python.org>Sent: Monday, August 21, 2006 9:50 PMSubject: [Tutor] how to get an email attachment > lo there python

[Tutor] prob with 64 encoded email attachement

2006-08-24 Thread shawn bright
hello there, i am having a bit o trouble being able to read a base64 encoded email attachement. here is the script. import email import poplib import base64 import os email_folder = 'emails/' mime = "application/octet-stream" def WriteAttachment(msg):     for part in msg.walk():     print p

[Tutor] revisiting struct module

2006-09-28 Thread shawn bright
Hey there,I am writing this because there is something that I am not understanding about the struct module.I have to send a message over a socket. The message has to be exactly 4 bytes, and the last bit has to be the value of 200. so like this:null,null,null,200 would be the message, and the 200 ha

Re: [Tutor] revisiting struct module

2006-09-28 Thread shawn bright
doesn't matter if its big endian or not ? anyway, thanks for lots of help, i would have replied sooner, but i was tinkering. -sk On 9/28/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: shawn bright wrote:> Hey there,> I am writing this because there is something that I am not>

[Tutor] revisiting struct and bytes again.

2006-10-04 Thread shawn bright
Hey there,this time my question is a bit simpler.i can make a byte a string or number or whatever now. Up to the number 255.I now have a problem with something that comes in as a 4 byte representation of the number of seconds since 1970. I have been using ord(byte) to make sense of the messages so

[Tutor] question about number of threads

2006-10-12 Thread shawn bright
Hey there, i have an app that runs several processes as threads. using the threading.Thread() now, i have another app that does the same thing. Now, pretty soon, we will be combining all the features of the two packages together into one app. My question is, is there a limit on how many threads

[Tutor] Fwd: question about number of threads

2006-10-12 Thread shawn bright
-- Forwarded message --From: shawn bright <[EMAIL PROTECTED]>Date: Oct 12, 2006 9:15 AM Subject: Re: [Tutor] question about number of threadsTo: Kent Johnson <[EMAIL PROTECTED]>oh, well then i do not have anything to worry about. I was  talking about a move from 6 threa

[Tutor] need some class / module help

2006-10-20 Thread shawn bright
Hey there,I am trying to create a module with one classthe module name is group.pyit looks like this so farimport DbConnectorclass Group(object):    def __init__(self, id):    self.id = id    con = DbConnector.DbConnector()    query = con.getOne("select `name`, `position` from `groups`

Re: [Tutor] need some class / module help

2006-10-20 Thread shawn bright
, thought i would take advantage of some stuff that might save me some time. thanks againshawnOn 10/20/06, Bob Gailer <[EMAIL PROTECTED]> wrote: shawn bright wrote: Hey there, I am trying to create a module with one class the module name is group.py it looks like this so far

Re: [Tutor] need some class / module help

2006-10-20 Thread shawn bright
oh, one more thing.these objects are going to be created at the rate of about 20 / minute in a thread.at some point is this going to be a problem ? do they go away over time?Or do i need to write something that will kill them? thanksskOn 10/20/06, shawn bright <[EMAIL PROTECTED]> wrote: Hey

Re: [Tutor] need some class / module help

2006-10-20 Thread shawn bright
?thanksOn 10/20/06, Simon Brunning < [EMAIL PROTECTED]> wrote:On 10/20/06, shawn bright < [EMAIL PROTECTED]> wrote:> oh, one more thing.> these objects are going to be created at the rate of about 20 / minute in a> thread.> at some point is this going to be a problem ? do they go

Re: [Tutor] need some class / module help

2006-10-20 Thread shawn bright
way cool, thanks much guys.skOn 10/20/06, Python <[EMAIL PROTECTED]> wrote: On Fri, 2006-10-20 at 13:44 -0500, shawn bright wrote:> if i name them, like bob = group.Group(some_id) ?>> what is going to happen is that each time, the variable will create a> different objec

[Tutor] can i pass a list to a function and get one back ?

2006-10-21 Thread shawn bright
hey there, i was just wondering if i could get a list back from a function.something likedef return_a_list(some_var):    some_list = []    for i in range(5):    var = some_var + i    some_list.append(var)     return some_listis this cool ?thanks    _

Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-21 Thread shawn bright
great, thanks,  i have idle right here, would have been just as easy.sorry about thatskOn 10/21/06, Bill Campbell < [EMAIL PROTECTED]> wrote:On Sat, Oct 21, 2006, shawn bright wrote:> >   hey there, i was just wondering if i could get a list back from a>   function.>   som

Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-21 Thread shawn bright
way cool, thanks. I am always looking for ways to clean things up-skOn 10/21/06, Danny Yoo <[EMAIL PROTECTED] > wrote:> great, thanks,  i have idle right here, would have been just as easy. > sorry about thatNo problem; it's cool.>> >   hey there, i was just wondering if i could get a list back fro

Re: [Tutor] can i pass a list to a function and get one back ?

2006-10-24 Thread shawn bright
he he heOn 10/23/06, John Fouhy <[EMAIL PROTECTED]> wrote: On 23/10/06, Kent Johnson <[EMAIL PROTECTED]> wrote:> or for that matter>return range(some_var:some_var+5)[nit-pick]That would berange(some_var, some_var+5) :-)--John.___Tutor maillist  - 

[Tutor] problem importing class

2006-10-26 Thread shawn bright
hey therei have written a module called site.pyin the file i have this:import DbConnectorimport sensorclass Site(object):    "site object"        def __init__(self, id):     self.id = id    self.con = DbConnector.DbConnector()        id = str(self.id)    stats = self.con.getOne(

Re: [Tutor] problem importing class

2006-10-26 Thread shawn bright
Hey thanks for the help, gents,i renamed site.py to site_obj.py and my import and statement.everything is working now. Thank you guys very very much.shawnOn 10/26/06, Danny Yoo <[EMAIL PROTECTED]> wrote: Hi Shawn,It looks like people have identified the problem, that your site.py moduleisn't being

Re: [Tutor] [pygtk] ListStore question

2006-10-27 Thread shawn bright
this is cool, ill give it a shotskOn 10/27/06, euoar <[EMAIL PROTECTED]> wrote: euoar escribió:> mc collilieux escribió:>> euoar wrote:>> I'm learning the use of liststores and treeviews. I have wrotten this litle class as exercice: # name is the name of the new column to add, valu

[Tutor] question about pylab

2006-10-30 Thread shawn bright
hey there,i am trying to use a graph and chart app called matplotlib, but i cannot figgure out how to have it plot a simple chart over time.the docs say to use the function plot_date() but i cannot seem to get the values to agree. I am sending datetimes to the charting app for x, and the y is a li

Re: [Tutor] question about pylab

2006-10-31 Thread shawn bright
ok, looks like the date2num() function on a datetime.datetime object is working. So cool.i am very new at this, so i may be back ( read probably be back ). Thanks much for the tips.i appreciate it a lot.sk On 10/31/06, Kent Johnson <[EMAIL PROTECTED]> wrote: shawn bright wrote:> hey the

[Tutor] question about __init__ in a class

2006-11-13 Thread shawn bright
Hello there all.i have a class that i need to load some class variables depending on what is passed to the class, it would either be set up using one variable or another. The values for the class variables would be loaded from a database. But how it is looked up depends on how its called. Like this

Re: [Tutor] question about __init__ in a class

2006-11-13 Thread shawn bright
Thats a lot better, thanks, will use it like that.-shawnOn 11/13/06, Mike Hansen <[EMAIL PROTECTED] > wrote:> -Original Message-> From: [EMAIL PROTECTED]> [mailto:[EMAIL PROTECTED]] On Behalf Of shawn bright> Sent: Monday, November 13, 2006 11:45 AM> To: tutor-py

Re: [Tutor] question about __init__ in a class

2006-11-13 Thread shawn bright
hey thanks, did not think about the possible consequences of the use of a built in as a variable name.-skOn 11/13/06, Andreas Kostyrka < [EMAIL PROTECTED]> wrote:* shawn bright < [EMAIL PROTECTED]> [061113 19:46]:> Hello there all.> i have a class that i need to load some class v

[Tutor] email content-type: text/plain

2006-11-16 Thread shawn bright
hey there all, i am using the email package and the phone provider i am trying to get a text message thru has sent me an email that says that they are looking for a tag that says 'content-type text/plain' i have tried about everything i can think of to get it in there, but everything i have tried

Re: [Tutor] email content-type: text/plain

2006-11-16 Thread shawn bright
MIMEText(message) to: msg = MIMEText(message, 'someTypeThatIsn'tPlain') On 11/16/06, shawn bright <[EMAIL PROTECTED]> wrote: > > hey there all, > i am using the email package and the phone provider i am trying to get a > text message thru has sent me an email that says t

Re: [Tutor] email content-type: text/plain

2006-11-16 Thread shawn bright
ok, will try this out tomorrow at work. thanks. sk On 11/16/06, Python <[EMAIL PROTECTED]> wrote: On Thu, 2006-11-16 at 15:57 -0600, shawn bright wrote: > use MIMEText(message, 'someTypeThatIsn'tPlain') ? but type/plain is > what i am after. > i am a bit confu

[Tutor] shebang question

2006-11-25 Thread shawn bright
Hey there all, what is the difference between #!/usr/bin/python and #!/usr/bin/env python ? thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] shebang question

2006-11-26 Thread shawn bright
well thanks for all the info, gents, i appreciate it a lot ! sk On 11/26/06, زياد بن عبدالعزيز الباتلي <[EMAIL PROTECTED]> wrote: "john maclean" <[EMAIL PROTECTED]> On Sun, 26 Nov 2006 01:34:28 + wrote: > From what I can tell/remember, the first works in the *nix environment > if python is

[Tutor] how to permanently add a module path

2006-12-22 Thread shawn bright
lo there, i am working with python in ubuntu, my app has some modules that i would like to import from anywhere. i can sys.path.append(my_module_dir)but it only lasts as long as that python session. how can i add a directory to the import path permantly ? thanks

Re: [Tutor] how to permanently add a module path

2006-12-22 Thread shawn bright
thanks, i usually intend to, getting used to gmail. thanks for all the help, all working now. shawn On 12/22/06, Christopher Arndt <[EMAIL PROTECTED]> wrote: shawn bright schrieb: > ok, > i am on ubuntu and there is no /etc/profile.d directory > i put this in the /etc/e

[Tutor] question about importing threads

2006-12-30 Thread shawn bright
Hello there all. i have an app that has grown to about 4000 lines. It uses 6 threads and a GTK2 GUI. i was wondering if i could split it into seperate files that i could import. Each thread is a class. i did not think that this would be a problem, but some of the threads pass information to views

Re: [Tutor] question about importing threads

2006-12-30 Thread shawn bright
AIL PROTECTED]> wrote: shawn bright wrote: > Hello there all. > i have an app that has grown to about 4000 lines. It uses 6 threads and > a GTK2 GUI. > i was wondering if i could split it into seperate files that i could > import. Each thread is a class. That should be fine. &

Re: [Tutor] question about importing threads

2006-12-30 Thread shawn bright
great help, and great link, thanks again. shawn On 12/30/06, Kent Johnson <[EMAIL PROTECTED]> wrote: shawn bright wrote: > Kent, Thanks. > this is great. Yes, when i start the thread, i also pass the gtk object > to it. > kinda like this. > > serial_1 = Seri

Re: [Tutor] question about importing threads

2006-12-31 Thread shawn bright
Thanks, Alan. Yes, the thing is getting to be a pain to deal with at this size, i am in-process of splitting out the classes into their own files. Thanks for your help. shawn On 12/30/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "shawn bright" <[EMAIL PROTECTED]> wrote i

[Tutor] how to know if a file exists

2007-01-03 Thread shawn bright
hello there, i am writing an app for linux. what command would be easiest to test and see if a certain file exist ? i was going to do something like this try: file = open('/path/to/file', 'rb') return True except: return False but i thought that there would be an easier way. thanks _

Re: [Tutor] how to know if a file exists

2007-01-03 Thread shawn bright
thanks, luke, Andre. appreciate it a lot shawn On 1/3/07, Andre Roberge <[EMAIL PROTECTED]> wrote: On 1/4/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > > shawn bright wrote: > > hello there, > > i am writing an app for linux. what command would be ea

[Tutor] how to stop a thread

2007-01-04 Thread shawn bright
hello there all, i have a python reference book that got me started knowing how to use threads, i can declare one as a class, and start it like this class SomeThread(threading.Thread): run_process = SomeThread() run_process.start() but how do i kill it ? This part is not in my book. Basically

Re: [Tutor] how to stop a thread

2007-01-04 Thread shawn bright
i can do that, will use my config file, thanks much and thanks for the link. shawn On 1/4/07, Kent Johnson <[EMAIL PROTECTED]> wrote: shawn bright wrote: > hello there all, > > i have a python reference book that got me started knowing how to use > threads, i can declare o

[Tutor] need help with sending email

2007-01-05 Thread shawn bright
lo there all. i am in a tight spot because i need to send an email that it mime encoded plain-text ( not html or anything ) no attachements, no images, just text from a string. like message = 'some message' all the tutorials i find out there, and the cookbook recipies are for sending multipart me

Re: [Tutor] need help with sending email

2007-01-05 Thread shawn bright
l Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of shawn bright > Sent: Friday, January 05, 2007 10:18 AM > To: tutor-python > Subject: [Tutor] need help with sending email > > lo there all. > > i am in a tight spot because i need to send an email tha

  1   2   >