[Tutor] Problems with matplotlib

2017-03-03 Thread Jason Snyder
;, line 13, in from matplotlib import rcParams ImportError: cannot import name rcParams What is causing these errors and what specific things do I need to do to resolve this. I need this explained clearly in a step by step way. Thanks, Jason -- Jason Snyder PhD __

[Tutor] pdf generation problem

2017-03-03 Thread Jason Snyder
I have the following program where I am trying to generate a pdf: 1 import matplotlib 2 matplotlib.use('AGG') 3 import matplotlib.pyplot as plt 4 import matplotlib.image as image 5 import matplotlib.gridspec as gridspec 6 from matplotlib.backends.backend_pdf imp

Re: [Tutor] grb.select for multiple times

2017-03-01 Thread Jason Snyder
In the below email I want to plot the time series of the uwind values at a specific latitude and longitude. On Wed, Mar 1, 2017 at 6:23 PM, Jason Snyder wrote: > I have a grib2 file with wind data at multiple taus as shown below: > > 3:485167:d=2017030112 <(201)%20703-0112>:

[Tutor] grb.select for multiple times

2017-03-01 Thread Jason Snyder
I have a grib2 file with wind data at multiple taus as shown below: 3:485167:d=2017030112:UGRD:10 m above ground:3 hour fcst: 8:1652471:d=2017030112:UGRD:10 m above ground:6 hour fcst: 13:2704909:d=2017030112:UGRD:10 m above ground:9 hour fcst: 18:3865964:d=2017030112:UGRD:10 m above ground:12 hou

[Tutor] pygrib issues involving wind

2017-02-28 Thread Jason Snyder
I have a grib2 file. You can see the components of this grib2 file below: wgrib2 -v chart_2017022812_0057.grb2 1:0:d=2017022812:RH Relative Humidity [%]:2 m above ground:57 hour fcst: 2:227081:d=2017022812:TMAX Maximum Temperature [K]:2 m above ground:54-57 hour max fcst: 3:486870:d=2017022812:U

[Tutor] Trouble Removing Whitespace

2016-11-07 Thread Jason Durnen
ite_language.rstrip() print(favorite_language) The following is the output I get from the two examples I have above: python python 'Python ' 'Python ' Press any key to continue . . . Any help you could give me would be greatly appre

Re: [Tutor] Dictionary Question

2016-05-02 Thread Jason N. via Tutor
ay 2, 2016 5:27 PM, "Jason N. via Tutor" wrote: > > Hello, > Wanted to ask if its possible to have a dictionary that can be looked up by > either values? > For example,  > mydic = {"A: "Apple", "B": "Banana"}When user inputs "A

[Tutor] Dictionary Question

2016-05-02 Thread Jason N. via Tutor
Hello, Wanted to ask if its possible to have a dictionary that can be looked up by either values? For example,  mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple" to come. But if the user enter "Apple" I want "A" to respond. Please let me know the best way to handle this type

Re: [Tutor] "List" object is not callable

2016-05-01 Thread Jason N. via Tutor
Hello, I figured out the issue. It was a silly mistake - i was not running the correct code; instead was running code from another program which was active on a second tab. Thank you. On Sunday, May 1, 2016 4:15 PM, Jason N. via Tutor wrote: Thank you all for your responses.  I am

Re: [Tutor] "List" object is not callable

2016-05-01 Thread Jason N. via Tutor
://unsee.cc/sonezima/ Thank you. On Saturday, April 30, 2016 11:12 PM, Steven D'Aprano wrote: On Sat, Apr 30, 2016 at 06:51:17PM +0000, Jason N. via Tutor wrote: > Hello, > I found this simple script online but when I execute it I get the > following error: "TypeError: &

[Tutor] "List" object is not callable

2016-04-30 Thread Jason N. via Tutor
Hello, I found this simple script online but when I execute it I get the following error: "TypeError: 'list' object is not callable" Here is the code sample:import subprocess ls_output= subprocess.check_output(['dir']) I searched online and found a another similar code sample (http://www.opentec

Re: [Tutor] Tutor Digest, Vol 146, Issue 9

2016-04-08 Thread Jason Willis
idinhere'. Once this has been done there is nothing > to stop you from writing:- > > id_ = 1 > id_ = 1.0 > id_ = Point(1, 2) > id_ = Complicated(lots, of, parameters, here) > > > > > Thanks a lot in advance! I hope I posted all the details needed and my > &

[Tutor] customizing dark_harvest problems

2016-04-07 Thread Jason Willis
Hi , I am a complete noob when it comes to python and programming in general. Though, I do know some things and can figure a little bit out when looking at source code I'm usually at a loss when understanding the entire workings of a program. Any and all help provided here would be greatly appreci

Re: [Tutor] Searching through files for values

2015-08-14 Thread Jason Brown
als = [ 'value1', 'value2', 'value3' ] And I still get the same issue. Only the first value in the list is looked up. Jason On Thu, Aug 13, 2015 at 7:32 PM, Cameron Simpson wrote: > On 13Aug2015 16:48, Jason Brown wrote: > >> I'm trying to search

[Tutor] Searching through files for values

2015-08-13 Thread Jason Brown
;, 'value2', 'value3'] print filenames returns: ['file1', 'file2', 'file3'] Any help would be greatly appreciated. Thanks, Jason ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Trying to use the Pillow library to create a gif

2014-11-18 Thread Jason Y
Hi,~This is a university assignment I'm working on.I have approximately 720 images all using the format "a ###.jpg", where # is a number (ie. "a 001.jpg").With these images, I'm attempting to create a gif by resizing an image (a 001.jpg) 10 times and than use a recursive function that should use

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread jason sam
The last question i hadn't asked yet..and if u are not interested in answering the question then also refrain from commenting please! On Thu, Jun 12, 2014 at 9:47 PM, Mark Lawrence wrote: > On 12/06/2014 05:51, jason sam wrote: > >> Hi All, >> I am new to wxPython.I have

Re: [Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-13 Thread jason sam
e "/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/forms/forms.py", line 181, in _update def _update(self, value): self._slider.SetValue(int(round(value))) TypeError: a float is required On Thu, Jun 12, 2014 at 6:39 PM, Alan Gauld wrote: > On 12/06/14 05:51, jason sam wro

[Tutor] AttributeError: 'module' object has no attribute 'start'

2014-06-12 Thread jason sam
Hi All, I am new to wxPython.I have made a simple GUI that contains a button and by pressing that button i am calling another .py file(top_block.py)...But i am getting error using the command: top_block.start() The error is: AttributeError: 'module' object has no attribute 'start' The code is a

Re: [Tutor] argparse iterable

2013-04-01 Thread Jason Friedman
#!/usr/bin/python import argparse parser = argparse.ArgumentParser(description='Short sample app') parser.add_argument('-a', action="store_true", default=False) parser.add_argument('-b', action="store", dest="b") parser.add_argument('-c', action="store", dest="c", type=int) parser.parse_args() for

Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread Jason Friedman
> Thank you for the response! I next modified the __str__ so it will also > include the values self. boredom and self. hunger. I am getting a bit > confused with how to set up strings from within a method. It is set up like > this: > > def __str__(self): > attrs = "Hunger: ", self.hunge

Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread Jason Friedman
> I am trying to use a __str__ method to display the values of attribute mood > = self.hunger + self. boredom. > When I try to execute I get this error: > > Traceback (most recent call last): > File "C:/Users/Vincent/Documents/Programming Tutorials/Python Programming > for the Absolute Beginner -

[Tutor] Python 2.7.3, Pygame, and LiveWires

2012-09-06 Thread Jason Fremouw
Hello, My name is Jason Fremouw. I recently began a Structured Programming course using Python as the tool with which we'll learn. The media packages listed above come as add-ons in my text book but are not compatible with 2.7. Are these now built into the latest build of Python or are

[Tutor] (no subject)

2012-06-01 Thread Jason Barrett
In python, why does 17/-10= -2? Shouldn't it be -1? Godsend221 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] help with program from learning python the hard way

2012-01-19 Thread Jason Loeve
good day i seem to be stuck, my code is from sys import argv script, user_name = argv and i get an error ValueError: need more than 1 value to unpack http://learnpythonthehardway.org/book/ex14.html i am using PyCharm 1.5.4 to run thanks in advance jason

[Tutor] Running a loop

2011-10-15 Thread Jason Barry
index=='ghost' and wheel2index=='pumpkin' and wheel3index== 'candie': print ('wins pumpkin, ghost, and candy.') elif wheel1index=='ghost' and w

Re: [Tutor] no luck with sqlinsert

2011-01-14 Thread Jason Staudenmayer
(cols[2]), int(cols[3]), int(cols[4]), \ int(cols[5]), int(cols[6]), int(cols[7])) Jason ..·><º> -Original Message- From: tutor-bounces+jasons=adventureaquarium@python.org [mailto:tutor-bounces+jasons=adventureaquarium@

Re: [Tutor] how avoid writing a newline?

2011-01-12 Thread Jason Staudenmayer
You should have a comma after the "#" in the highlighted print statement, that should repress the new line (I'm guessing that's the line you're talking about) print >> f,t,"#", Jason ..·><º> -Original Message- From: tut

Re: [Tutor] shlex.split if there is an apostrophe in the string?

2011-01-07 Thread Jason Staudenmayer
ilman/listinfo/tutor > WARNING Total newbie here. Looks like you need to filter you data to excape the quote marks. I'm just learning so I'm not sure how to do that yet. Jason ..·><º> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] user input help

2011-01-05 Thread Jason Staudenmayer
> -Original Message- > From: Alex Hall [mailto:mehg...@gmail.com] > Sent: Wednesday, January 05, 2011 3:23 PM > To: Jason Staudenmayer > Cc: tutor@python.org > Subject: Re: [Tutor] user input help > > > On 1/5/11, Jason Staudenmayer wrote: > > Hi all,

[Tutor] user input help

2011-01-05 Thread Jason Staudenmayer
add user" print "%s, %s %s" % (result[1], result[0], result[2]) else: check = "" promptInput() The if else loop is were I'm loosing it. If I select n it will ask for the input again but only once. If on the second time around I ente

[Tutor] Menu not working properly

2010-08-02 Thread Jason MacFiggen
My problem is choice 3. Exit, if you select no or put an invalid answer... It will run menu1... but then it runs name = raw_input ("Enter your character name. ") print "Your character name is:", name How can i make it so it prints menu1 like normal... then asks you to enter your selection

[Tutor] sys.exit help

2010-08-01 Thread Jason MacFiggen
I was wondering how can I change sys.exit so if you use command line to run the program. it prompts a message asking if the user wants to exit instead of automatically just exiting? import random import sys my_hp = 50 mo_hp = 50 menu1 = """ Menu Selections: 1 - Attack

[Tutor] Simple Python Program

2010-07-30 Thread Jason MacFiggen
Can anyone tell me how to fix the errors I am getting if possible? I'm quite new and so confused... also how do I display the winner under the displayInfo function? import random def main(): print playerOne, playerTwo = inputNames(playerOne, PlayerTwo) while endProgram == 'no':

[Tutor] Python - RPG Combat System

2010-07-30 Thread Jason MacFiggen
I am have trouble figuring out how to make my program stop at 0 hit points if I run it, it always goes into the negative hitpoints... So my question is how do I make this program end at exactly 0 hit points every time instead of going over? and also, what can I do instead of writing print so

[Tutor] Python Help - How to end program

2010-07-28 Thread Jason MacFiggen
Python keeps looping when it gets past the int 0, how do I end the program when it the int 0 or > 0. my_hp = 50 mo_hp = 50 my_dmg = random.randrange(1, 20) mo_dmg = random.randrange(1, 20) endProgram = end() while True: if mo_hp < 0: print "The Lich King has

Re: [Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Jason Willis
ventory.py herosinventory.py: command not found co...@compy-laptop:~/pythons$ herosinventory herosinventory: command not found co...@compy-laptop:~/pythons$ I must be retarded. I'm sorry , what am I doing wrong here? On Wed, Oct 21, 2009 at 2:31 PM, vince spicer wrote: > > > On Wed, Oct 21,

[Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

2009-10-21 Thread Jason Willis
hi everyone, sorry for the rather boring question but i'm having serious issues getting my programs to run from the command line without having to type "python" in-front of them. I've tried a lot of different variations on the #!/usr/bin/ etc. line and have come up with the following every time:

[Tutor] complete neophyte question here

2009-10-12 Thread Jason Willis
I've recently been going through "Python Programming, for the Absolute Beginner" Second Edition, By Michael Dawson I'm running python 2.5.4 on a windows xp home machine. So my question boils down to this: At the end of one of his chapters there is a challenge to write a program that flips a "co

[Tutor] mod_python

2008-11-28 Thread Jason DeBord
Is mod_python the only way to integrate python and apache2 ? I am interested in using Python instead of PHP and would like to use Python's template style as well as a framework such as Pylons or Django. Thanks in advance! -- - - - - - - - - - - - - - Jason Limoges, F

[Tutor] Leaving PHP for Python

2008-11-25 Thread Jason DeBord
ably Amazon Web Services. Also, I'd like to write some server side scripts to serve as a backend to some Adobe AIR apps. Any and all advice is extremely appreciated. Thanks for your time! Sincerely, Jason ___ Tutor maillist - Tutor@python.org ht

Re: [Tutor] Learning Python from books

2008-06-19 Thread Jason Conner
I use the same books - Learning Python and Core Python Programming, 2nd ed. I found I got about halfway through Learning Python before I switched to CPP and had no problems. I also use "Python Phrasebook" (Brad Dayley, 2007) as a handy reference guide to some common problems as well. Core Python P

Re: [Tutor] Reading only a few specific lines of a file

2008-05-24 Thread Jason Conner
Hey guys, I went with a combination of the above, though I tried several different solutions. Here's what I ended up with: def loadItem(self, objectToLoad): wordList = [] fobj = open('/home/jason.conner/Documents/Python/objectconfig.txt', 'r') for line in fobj: if line == obj

[Tutor] Reading only a few specific lines of a file

2008-05-22 Thread Jason Conner
Hey guys, Very new to programming Python, and I'm running up against a problem. I am building a program that will take a text file, search for a string in that text file. Once it finds the string its looking for, I want to put the next five lines of text into a variable. Here's what I have so far:

Re: [Tutor] Processing .NK2 files

2008-02-15 Thread Jason Coggins
How can I check the speed of the internet connection in Python? Jason___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] the bios serial number

2008-02-15 Thread Jason Coggins
How do you pull up the bios serial number in Python? Jason___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Projects

2008-01-23 Thread Jason Massey
e"; case 6: return "six"; case 7: return "seven"; case 8: return "eight"; case 9: return "nine"; default: return "\nFatal Error!\n"; // should I abort pgm? } // end of switch } // end of convert

Re: [Tutor] Random Number Generator

2007-12-04 Thread Jason Massey
Easy enough. You'll want to import the random module and use the functions in it. Also, http://docs.python.org/lib/lib.html is going to be your best friend. You'll notice on that page among many other things is a section on random number generation. As to your code: >>>import random >>>a = ran

Re: [Tutor] update a ws.ListBox

2007-11-28 Thread Jason Massey
Inserting this line: self.listbox2.InsertItems([choice],0) in your OnListBox1 method after your if/then/else statement puts the item you select in ListBox1 appear in ListBox2. You have to force choice into a list, otherwise it will insert each individual letter in the string into the box one at

Re: [Tutor] for a given file, how to find file size?

2007-10-03 Thread Jason Massey
Are you sure? From the link you provided it looks as if: *stat*( path) Perform a stat() system call on the given path. The return value is an object whose attributes correspond to the members of the statstructure, namely: st_mode (protection bits), st_ino (inode number), st_dev (device), st_nlink

Re: [Tutor] New to Python and Linux

2007-09-25 Thread Jason M Barnes
x, then you'll need to learn how to make the most of your CLI. I'd suggest googling for tutorials on the linux command line. Jason ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Capturing ctrl-c

2007-09-24 Thread Jason Massey
Interesting. As Michael suggested this works, mostly: from time import sleep def loop(): x = 0 while 1: print "x:",x x += 1 sleep(0.5) if __name__ == "__main__": while 1: try: loop() except KeyboardInterrupt: print "Nop

[Tutor] Jason Timms is out of the office.

2007-09-07 Thread Jason . Timms
I will be out of the office starting 09/07/2007 and will not return until 09/09/2007. I will respond to your message when I return. ** Privileged and/or confidential information may be contained in this message. If you are not the addres

Re: [Tutor] Dynamically changing a class

2007-09-05 Thread Jason Doege
ing a class with a bunch of empty methods and then redefining them, I have not seen a good way to do this in Python. Can you recommend the Pythonic way to do this? Best regards, Jason Doege ___ Tutor maillist - Tutor@python.org http://mail.python.org/ma

[Tutor] Dynamically changing a class

2007-09-03 Thread Jason Doege
dance on how to accomplish this? I'd also like to be able to add and delete attributes, similarly. Best regards, Jason Doege ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Pass variable on command line

2007-07-26 Thread jason
Ok, I see now. A dictionary using the list elements as values. This will work for me. Thanks! jason On 7/26/07, Eric Brunson <[EMAIL PROTECTED]> wrote: jason wrote: > Hello, > > I have a situation where I have 2 lists > > List1 = ['blue', 'red', gr

[Tutor] Pass variable on command line

2007-07-26 Thread jason
sys.argv[1] But how can I then use the values in that list inside my program? If I do a VALUES = sys.argv[1], then I get List1 as the values. I want the actual list elements. Is this possible? Thank you Jason ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Bundle help!

2007-07-16 Thread Jason Massey
A nice tutorial on using regular expressions in Python: http://www.amk.ca/python/howto/regex/ On 7/15/07, bhaaluu <[EMAIL PROTECTED]> wrote: Hi! http://docs.python.org/lib/module-re.html Regular Expressions module. On 7/15/07, Sara Johnson <[EMAIL PROTECTED]> wrote: >

[Tutor] (no subject)

2007-06-29 Thread Jason Bertrand
Please remove me from the mailing list. Thank you Jason P Bertrand JPB Enterprises www.businessloansandleasing.com (860) 982-5334 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Jason Massey
Also since you're writing your found results to a file there's no need to print the results to the screen. That should shave off some time, especially if you have a lot of hits. On 6/26/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Robert Hicks wrote: > idList only has about 129 id numbers in it

Re: [Tutor] subprocess and launching an editor

2007-06-22 Thread Jason Massey
I'm running Feisty as well. I launched python in two separate consoles and tried this: 1st console import subprocess subprocess.call('gedit --new-window window1',shell=True) gedit launches with a blank file called window1. The python shell is now waiting for gedit to exit be

Re: [Tutor] Help converting base32 to base16

2007-06-18 Thread Jason Massey
Nice entry at wikipedia: http://en.wikipedia.org/wiki/Base_32 I like the naming of Base32: *duotrigesimal *Gotta try to work that into a conversation somehow.* * On 6/18/07, Alan Gauld <[EMAIL PROTECTED]> wrote: "cms cms" <[EMAIL PROTECTED]> wrote > Newbie here trying to find a module that I

Re: [Tutor] Get max quantity

2007-06-13 Thread Jason Massey
More than one way to skin a cat: import operator sort_key = operator.itemgetter(1) sorted(inventory.items(),key=sort_key)[-1] ('oranges',525) or... inventory.items() [('pears', 217), ('apples', 430), ('oranges', 525), ('bananas', 312)] count_first = [(count,fruit) for fruit,count in invent

Re: [Tutor] example of spawn

2007-06-05 Thread Jason Coggins
p', 'index.html', '/dev/null') ---- Jason - Original Message - From: "Alan Gauld" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 05, 2007 5:32 PM Subject: Re: [Tutor] example of spawn > "Ja

[Tutor] example of spawn

2007-06-05 Thread Jason Coggins
Would someone please provide me a short, simple example of the spawn statement. I am having trouble figuring the syntax out. Jason___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] ftp

2007-06-03 Thread Jason Coggins
What would be the best method to (1) check if there is a particular file available for download on the internet and (2) if the file is available, download the file to a particular directory. Jason___ Tutor maillist - Tutor@python.org http://mail.pyth

Re: [Tutor] Command Line Promps

2007-06-03 Thread Jason Coggins
Will the program that is started by the thread continue to run if the program that started the thread exits? Jason - Original Message - From: "jim stockford" <[EMAIL PROTECTED]> To: "Jason Coggins" <[EMAIL PROTECTED]> Cc: Sent: Sunday, June 03,

Re: [Tutor] Command Line Promps

2007-06-03 Thread Jason Coggins
ience then when I tried it the first time. I used the reply button to send a reply to the first message. I did not realize it would send the reply directly to you instead of the list. I have tried to send this reply to the list. Thanks, Jason - Original Message - From: "Bob Gai

[Tutor] Command Line Promps

2007-06-03 Thread Jason Coggins
Is it possible to have a Python program issue a command line promp to the terminal while the program is running? Jason___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python for s60

2007-05-16 Thread Jason Massey
Google is your friend: http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLR,GGLR:2006-33,GGLR:en&q=python+symbian The first link in particular looks good. On 5/16/07, Chenthil <[EMAIL PROTECTED]> wrote: Hi can some one show nd some good tutorials for writing scripts for symbian

[Tutor] Text matching

2007-05-15 Thread Jason Massey
heh... forwarding to the list, too. -- Forwarded message -- From: Jason Massey <[EMAIL PROTECTED]> Date: May 15, 2007 6:51 AM Subject: Re: [Tutor] Text matching To: "Gardner, Dean" <[EMAIL PROTECTED]> Look at it a different way. If the one thing that is s

[Tutor] Lexer implementation

2007-05-09 Thread Jason Doege
Hi All, Is there a classical way to implement a lexer in Python without using a parser toolkit? Something like the lexer MJD illustrates in Higher Order Perl, section 8.1.2. It's even better if it can act on a stream instead of a string. Best regards, Jason

[Tutor] Trouble creating DB2 drivers

2007-05-08 Thread Jason Meiers
Hi, Where you ever able to get this issue resolved, I've got the same issue? http://mail.python.org/pipermail/tutor/2007-February/052994.html Best Regards, Jason Meiers Production Monitoring Pay By Touch -- 101 2nd Street, Suite

[Tutor] command lines

2007-05-06 Thread Jason Coggins
Is there a way to send a command to the Linux Terminal from inside a Python program? Jason___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] base directory

2007-05-05 Thread Jason Coggins
I am new to Linux. On Windows the base directory is c:\. If I wanted to open a file in a specific location in windows I would use a path such as c:\programs\fileName.py. What is the base directory for Linux? Jason___ Tutor maillist - Tutor@python.

[Tutor] exec syntax

2007-05-05 Thread Jason Coggins
Would someone please provide me with a simple example of the syntax to use the exec command to open a file. I can see how to use it to execute a script of code embedded in the program (that example was provided in the documentation) but I cannot figure out the syntax to use it to run another py

[Tutor] What's wrong with this?

2007-05-03 Thread Jason Coggins
I have the following function in a program: os.popen('filename.py') What I want to do is launch the program in the os.popen() function. The file I am trying to launch is located in the same directory as the program the function is contained in. I also use Linux if that makes a difference. Ja

[Tutor] os.path.join question

2007-05-03 Thread Jason Coggins
Is it possible to use os.path.join to link to a file located in the directory above where you are currently located? If so, what is the syntax? Jason___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] 'word jumble' game

2007-04-17 Thread Jason Massey
The main thing your program lacks is flexibility. Adding new puzzles requires chaining together a series of if..else statements and creating variables for each hint. Here's my quick version. I store the puzzles and the hints in a two-tuple sequence. Following this method you could easily add a

Re: [Tutor] Why is it...

2007-03-22 Thread Jason Massey
In the interpreter this doesn't work: f = open(r"c:\python24\image.dat") line = f.readline() while line: ... line = f.readline() ... f.close() Traceback ( File "", line 3 f.close() ^ SyntaxError: invalid syntax But this does: f = open(r"c:\python24\image.dat") line = f.readline()

Re: [Tutor] HTTP file download

2007-03-14 Thread Jason Massey
I've tested this on my Apache server setup, it succesfully downloads the gif file and the text file and saves them. Even though I used the 'wb' flag (write binary) for the text file it turned out okay (the difference in 'w' and 'wb' seemed to be that 'wb' stripped off some of my blank lines). On

Re: [Tutor] declaring decaration on ul list

2007-03-14 Thread Jason Massey
You'll need a style sheet. See: http://alistapart.com/articles/taminglists/ On 3/14/07, Kirk Bailey <[EMAIL PROTECTED]> wrote: It just occurred to me that when my wiki does a backsearch it is useful to list the results with a * for decorating the unordered list results, so I can mousecopy it t

Re: [Tutor] Squlite3 problem

2007-03-13 Thread Jason Massey
I found a similar discussion on the pysqlite mailing list ( http://lists.initd.org/pipermail/pysqlite/2005-August/000127.html) Try committing your changes and then closing your cursor. db.commit() cur.close() db.close() On 3/13/07, Jim Roush <[EMAIL PROTECTED]> wrote: I'm geting the followin

Re: [Tutor] Two sys.exit questions

2007-02-28 Thread Jason Massey
When you call sys.exit() you're raising a SystemExit exception. help(sys.exit) Help on built-in function exit in module sys: exit(...) exit([status]) Exit the interpreter by raising SystemExit(status). If the status is omitted or None, it defaults to zero (i.e., success). If the s

Re: [Tutor] Reg Google Web Toolkit and Python

2007-02-16 Thread Jason Massey
Oh, the irony...googling for python and gwt gave me: http://pyjamas.pyworks.org/ On 2/16/07, Shadab Sayani <[EMAIL PROTECTED]> wrote: Hi , We have a project where I need to read files store them in database in the backend.We have done this in python.Now we decided to use Ajax technique for u

Re: [Tutor] Python gui for file input

2007-01-05 Thread Jason Massey
The simplest way would be to use TkInter which is distributed with Python. Check out the cookbook recipe at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438123 for a bunch of examples. jason On 1/5/07, Mike Ellis <[EMAIL PROTECTED]> wrote: Hi all, I am looking to cr

Re: [Tutor] python cx_Oracle.LOB

2007-01-02 Thread Jason Massey
An example of your code would help. According to the cx_oracle docs at http://www.python.net/crew/atuining/cx_Oracle/html/index.html under the LOB Objects heading: 6. LOB Objects *NOTE*: This object is an extension the DB API. It is returned whenever Oracle CLOB, BLOB and BFILE columns are fetch

Re: [Tutor] How to allow user to choose an option from a window

2006-12-12 Thread Jason Massey
If you mean which type of GUI model to use you have at least two popular choices. Tkinter: It's bundled with Python, and there's a tutorial at: http://www.pythonware.com/library/tkinter/introduction/ wxPython: My GUI of choice. http://wxpython.org A quick and dirty example in wxPython of what y

Re: [Tutor] Why SelectAll() cannot work well ?

2006-11-30 Thread Jason Massey
I'm running WinXP and the entire text is selected when you enter a new choice. In fact, on XP at least, you don't have to use SelectAll, SetFocus selected the entire text. On 11/30/06, Jia Lu <[EMAIL PROTECTED]> wrote: Hi all I am using wx Py with FC6. I ran the program below but I found th

Re: [Tutor] Having trouble with " table % listTable.values() " line

2006-11-24 Thread Jason Massey
So you want to convert a list into a tuple. Here ya go, using your example of the table setup: raw_table =""" %s | %s | %s -- %s | %s | %s -- %s | %s | %s """ from random import choice x_o = [choice(['x','o']) for i in range(9)] x_o ['x', 'x', 'x', 'x', 'o', 'o', 'o',

Re: [Tutor] Problem making '.exe' from python.

2006-11-17 Thread Jason Massey
Check to make sure that under the shortcut properties that you have the "Start in" field filled out with the directory the script is located. On 11/17/06, Chris Hengge <[EMAIL PROTECTED]> wrote: Whether using py2exe or pyInstaller I've noticed a problem and I'm not sure how to fix it... When I

Re: [Tutor] how to extract time from datetime.date.time()

2006-11-16 Thread Jason Massey
How about two different ways: import datetime t = datetime.datetime.now() t datetime.datetime(2006, 11, 16, 11, 28, 15, 75) t.hour 11 t.minute 28 t.second 15 a = "%d:%d:%d" % (t.hour,t.minute,t.second) a '11:28:15' or, a bit more succinctly: t.strftime('%H:%M:%S') '11:28:15'

Re: [Tutor] Tuple and Dicts?

2006-11-09 Thread Jason Massey
How about something like:>>> data = "" 0, 'title': 'Linux'}, {'id': 1, 'title': 'FreeBSD'})>>> id = 0>>> result = [x for x in data if x['id'] == id][{'id': 0, 'title': 'Linux'}] >>> result = [x for x in data if x['id'] == id]>>> result[0]{'id': 0, 'title': 'Linux'}>>> You get the entire dict entry

Re: [Tutor] problem importing class

2006-10-26 Thread Jason Massey
Shawn,Python already has a module called site.  From http://docs.python.org/lib/module-site.html :This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter's -S option. Importing this module will append site-specific paths to the mo

Re: [Tutor] Decimal truncation, rounding etc.

2006-10-25 Thread Jason Massey
More specifically, Joe, where and what types of errors are you getting?When I type in your example exactly as above I get the following:>>>from decimal import *>>> Decimal('7.').quantize(Decimal('1.000'),rounding=decimal.ROUND_DOWN)Traceback (most recent call last):  File "", line 1, in ?NameE

Re: [Tutor] regarding GNUPLOT and MATPLOTLIB..

2006-10-23 Thread Jason Massey
e 17, in ?     from matplotlib._ns_nxutils import *ImportError: numpy.core.multiarray failed to import   On 10/23/06, Jason Massey < [EMAIL PROTECTED]> wrote: Very possible:For gnuplot: http://gnuplot-py.sourceforge.net/  See the instructions for using on Windows.For Matplotlib: http://

Re: [Tutor] regarding GNUPLOT and MATPLOTLIB..

2006-10-23 Thread Jason Massey
Very possible:For gnuplot:http://gnuplot-py.sourceforge.net/  See the instructions for using on Windows.For Matplotlib: http://matplotlib.sourceforge.net/installing.htmlPossibly what's confusing you is that both versions have external dependencies such as Numpy and Numeric (are those the same?  I'l

Re: [Tutor] Best way to replace items in a list.

2006-10-20 Thread Jason Massey
ll that replace the location? or add to it? Thanks.On 10/20/06, Jason Massey < [EMAIL PROTECTED] > wrote:Why not:if item in list: loc = list.index(item)  list[loc] = strOn 10/20/06, Chris Hengge < [EMAIL PROTECTED]> wrote: I'm trying to build a little piece of code that repla

Re: [Tutor] Best way to replace items in a list.

2006-10-20 Thread Jason Massey
Why not:if item in list: loc = list.index(item) list[loc] = strOn 10/20/06, Chris Hengge < [EMAIL PROTECTED]> wrote:I'm trying to build a little piece of code that replaces an item in a list. Here is a sample of what I'd like to do.str = "This was replaced"ff item in list:   replace item with str

Re: [Tutor] passing a variable ?

2006-10-19 Thread Jason Massey
It should look like this:fout = file('/home/cable/sandbox/%s' % savename, 'a''w')The variables come immediately after the string your formatting.On 10/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I am stumped.  I am trying to pass the variable 'savename' to a stringand get errors.can someon

  1   2   >