Re: [Tutor] Using pip

2018-07-05 Thread James Reynolds
On Thu, Jul 5, 2018 at 12:55 PM Hlavin, Matthew (GSFC-5460)[GSFC INTERNS] < matthew.hla...@nasa.gov> wrote: > I just downloaded Python to work on a project at work. I'm writing a > pretty simple program for data collection for an experiment. In order to > get the data, though I need to install PyV

Re: [Tutor] Can't install latest PIL

2013-05-16 Thread James Reynolds
You may want to consider pillow. Oil hasn't been maintained in some time. On May 16, 2013 6:12 PM, "Jim Mooney" wrote: > Make sure you have the correct architecture. The builds from > PythonWare are 32-bit. Christoph Gohlke has 64-bit builds here: > > http://www.lfd.uci.edu/~gohlke/pythonlibs/#p

Re: [Tutor] building a website with python

2013-04-09 Thread James Reynolds
As far as hosts, I use digital ocean. It's a cloud based thing like EC2, but it's cheap (5/10/20 and up). You will of course have to configure everything yourself, but that's not such a bad thing. It will give you good experience configuring a linux box as well and learning about deployment. Sinc

Re: [Tutor] Which pip for Ubuntu 12.04

2013-02-10 Thread James Reynolds
The bigger issue with mongo is the apt versions are old. Be sure to follow the instructions on mongos site. If you pip install pymongo with a ubunuto or mint build your gtg ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opt

Re: [Tutor] PostreSQL

2012-11-15 Thread James Reynolds
Psycopg2 is the driver for postgres. Not sure if it is py3k compliant On Nov 15, 2012 6:13 AM, "Válas Péter" wrote: > Two listings, of course. :-) > I failed to tell that my PG version is "PostgreSQL 8.1.2" (and my client > uses Windows 7, if this has relevance). > > 2012/11/15 Válas Péter > >>

Re: [Tutor] What can I do if I'm banned from a website??

2012-10-10 Thread James Reynolds
On Wed, Oct 10, 2012 at 4:35 PM, Benjamin Fishbein wrote: > I've been scraping info from a website with a url program I wrote. But now > I can't open their webpage, no matter which web browser I use. I think > they've somehow blocked me. How can I get back in? Is it a temporary block? > And can I

Re: [Tutor] Python cms

2012-08-19 Thread James Reynolds
I agree with Steven. You will notice efficiency gains by moving to python. I'm a django developer myself, but some of the other frameworks work well also. That said the django community is fairly large, and there is an active cms project called django-cms. https://www.django-cms.org/ Sent f

Re: [Tutor] I-Phone App in Python?

2012-08-04 Thread James Reynolds
n outside of it, then I suppose you won't be able to use Python to any degree. But, if you do, then you can write fantastic apps using python libraries for the backend needs. On Sat, Aug 4, 2012 at 2:28 PM, Chris Fox wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 >

Re: [Tutor] I-Phone App in Python?

2012-08-04 Thread James Reynolds
To clarify, that is their server side arc. The native app itself... I'm not sure what is written in. Probably java if I had to guess. In making an app, most of your work is going to be backend in any event. Also, what happens when an android user wants to download your app? Sent from my iPad

Re: [Tutor] I-Phone App in Python?

2012-08-04 Thread James Reynolds
Instagram is written in python django. Sent from my iPad On Aug 3, 2012, at 7:13 PM, Fred G wrote: > I just googled whether it is possible to write an i-phone app in Python and > got very confusing, and not super good results. > > Is it possible? And if so, what module(s) do I need to instal

Re: [Tutor] advice on global variables

2012-07-11 Thread James Reynolds
On Wed, Jul 11, 2012 at 10:30 AM, Chris Hare wrote: > > On Jul 11, 2012, at 8:05 AM, Walter Prins wrote: > > > [snip] > > > Your original example modified as demonstration: > > > > a.py: > > > > import shared > > import b > > > > def func1(): > >print "global var in func1 = %s" % sha

Re: [Tutor] advice on global variables

2012-07-10 Thread James Reynolds
Sent from my iPad On Jul 10, 2012, at 3:11 PM, Chris Hare wrote: > > I know they are bad. That is why I would prefer not to use it, but I am not > sure how else to handle this problem. > > In this app, the user must log in. Once authenticated, they have a userid > stored in the SQLite da

Re: [Tutor] advice on global variables

2012-07-10 Thread James Reynolds
On Tue, Jul 10, 2012 at 4:32 PM, Prasad, Ramit wrote: > > You should avoid using the global statement. > > > > In your case, I would think you could just add an argument to the method: > > > > class MyObj(object): > > def __init__(self, arg): > > self.arg = arg > > def my_func(self

Re: [Tutor] advice on global variables

2012-07-10 Thread James Reynolds
On Tue, Jul 10, 2012 at 3:11 PM, Chris Hare wrote: > > I know they are bad. That is why I would prefer not to use it, but I am > not sure how else to handle this problem. > > In this app, the user must log in. Once authenticated, they have a userid > stored in the SQLite database. Before split

Re: [Tutor] web design and python

2012-06-21 Thread James Reynolds
On Thu, Jun 21, 2012 at 6:53 PM, Tamar Osher wrote: > I have many questions, and eagerly ask you to please respond to me. I > value your expertise, and greatly appreciate you taking the time to share. > I want to find out, in elaborate detail, about the Python/Django > relationship to web desig

Re: [Tutor] Pymongo Error

2012-06-19 Thread James Reynolds
On Tue, Jun 19, 2012 at 1:22 AM, Ranjith Kumar wrote: > Hi all, > I tried Django with Mongodb while running manage.py syncdb I endup with > this error > > note : it works fine with sqlite and mysql db > > (django-1.3)ranjith@ranjith:~/ > sandbox/python-box/hukkster-core-site/hukk$ ./manage.py sync

Re: [Tutor] Dictionary

2012-06-17 Thread James Reynolds
Does this language have grammar independent of english? If no, just use .split() on the string and loop through that. If yes, well, its much more complicated On Jun 17, 2012 2:27 PM, "Selby Rowley-Cannon" wrote: > Version: 2.7 > OS: Ubuntu 12.04 LTS > > I am writing a small translation app for

Re: [Tutor] Web Questionnaire

2012-06-04 Thread James Reynolds
I would say start using django. The best way to learn is by doing. This will let you learn about databases, servers, webapps, and you can get some functionality out of it. Just start going through the django tutorial. On Jun 4, 2012 11:57 AM, "Joel Goldstick" wrote: > On Mon, Jun 4, 2012 at 11:

Re: [Tutor] Connecting to MySQLdb

2012-06-01 Thread James Reynolds
Virtualenv works just fine in windows On Jun 1, 2012 7:20 PM, "Corey Richardson" wrote: > On Fri, 1 Jun 2012 19:01:00 -0400 > Nicholas Picciano wrote: > > > Hello, > > > > I have downloaded MySQLdb 1.2.3 from: > > > > http://pypi.python.org/pypi/MySQL-python > > > > Also, I'm using Python 2.7,

Re: [Tutor] Benefit/Disadvantage to storing data as dictionary vs. in a class

2012-06-01 Thread James Reynolds
On Fri, Jun 1, 2012 at 9:12 AM, Adam wrote: > I'm working on a class that handles multiple rooms that generate a large > amount of data. Currently my class model looks something like this (more > apologies for any indentation errors): > Class Model: >rooms= {} >for z in range(num_of_zones

Re: [Tutor] How install Pyramid on a Windows 7 computer?

2012-05-31 Thread James Reynolds
I don't think django 1.5 is ready, but they are targeting python3k. There is a fork of django i think on bitbucket that works as well. On May 31, 2012 12:33 PM, "Vince Spicer" wrote: > Step 1) install Ubuntu > > OK sorry couldn't resist. > > This should help. > > http://docs.pylonsproject.org/pr

Re: [Tutor] summing lists

2012-04-10 Thread James Reynolds
On Tue, Apr 10, 2012 at 11:22 AM, Hs Hs wrote: > Hi: > > I have 4 lists: > > >>> a > [40] > >>> b > [2] > >>> c > [23] > >>> d > [12] > > > how is it possible to do add elements in list. I can do this using > tupples, but I do not know how to append elements to tuple, thats the > reason I am usin

Re: [Tutor] Lists and While Loops

2012-03-28 Thread James Reynolds
On Wed, Mar 28, 2012 at 2:53 PM, Ricky Brown wrote: > So I have to write a program that reads a message from the user and prints > a new message that contains all the words from the original message but in > the same order without repeating any of them unless they show up more than > once in the

Re: [Tutor] FW: null inputs

2012-03-15 Thread James Reynolds
On Thu, Mar 15, 2012 at 10:32 AM, ADRIAN KELLY wrote: > > > Adrian Kelly > 1 Bramble Close > Baylough > Athlone > County Westmeath > > 0879495663 > > > -- > From: kellyadr...@hotmail.com > To: tutor@python.org > Subject: null inputs > Date: Thu, 15 Mar 2012 14:19:16 +0

Re: [Tutor] formatting sql Was: Some help Please

2012-02-15 Thread James Reynolds
On Wed, Feb 15, 2012 at 1:30 PM, Alan Gauld wrote: > On 15/02/12 18:03, James Reynolds wrote: > > >In you table the acc_id is 'mn0001' >> >In your sql Acc_ID = 'MN0001' >> >Why the difference in case? >> >> Normal

Re: [Tutor] formatting sql Was: Some help Please

2012-02-15 Thread James Reynolds
On Wed, Feb 15, 2012 at 12:13 PM, bob gailer wrote: > Welcome to python help. We are a few volunteers who donate time to assist. > > To assist you better: > 1 - provide a meaningful subject line - such as "formatting sql" > 2 - tell us what OS and Python version you are using. > 3 - what is your

Re: [Tutor] decimal precision in python

2012-02-06 Thread James Reynolds
On Mon, Feb 6, 2012 at 10:25 AM, Kapil Shukla wrote: > i tried writing a small code to calculate option price using the binomial > tree model. I compared my results with results of the same program in > excel. There seems to be a minor difference due to decimal precision as > excel is using 15 dec

Re: [Tutor] Using Python for a client interactive map application

2012-01-05 Thread James Reynolds
On Thu, Jan 5, 2012 at 10:58 AM, Alexander wrote: > Dear friends, > I'm emailing regarding a general question about working with Python and a > web-browser based interactive map application. Over the summer I had asked > a similar question and heard some things about the Django framework, does >

Re: [Tutor] help with script

2011-12-27 Thread James Reynolds
On Tue, Dec 27, 2011 at 8:31 PM, wrote: > hello, my name is nick. i got python for software design by Allen B. > Downey as a gift for christmas. i am completely new to programming and i am > having trouble figuring out how to do an exercise concerning script.. > my problem > 5 > x=5 > x+1 > im ok

Re: [Tutor] A few Python Mysteries

2011-12-20 Thread James Reynolds
On Tue, Dec 20, 2011 at 9:32 PM, Wayne Watson wrote: > I changed Python25 to Python27, and rebooted. I got the same two dll msgs > again. > > > On 12/19/2011 7:33 PM, Wayne Watson wrote: > >> It became apparent during the other part of this thread that I had not >> uninstalled Python 2.7, as I th

Re: [Tutor] A few Python Mysteries

2011-12-19 Thread James Reynolds
On Mon, Dec 19, 2011 at 2:21 PM, Wayne Watson wrote: > > > On 12/19/2011 8:50 AM, James Reynolds wrote: > > > > On Mon, Dec 19, 2011 at 11:35 AM, Wayne Watson < > sierra_mtnv...@sbcglobal.net> wrote: > >> Win 7, 64-bit >> >> I had Py 2.5 install

Re: [Tutor] A few Python Mysteries

2011-12-19 Thread James Reynolds
On Mon, Dec 19, 2011 at 11:35 AM, Wayne Watson wrote: > Win 7, 64-bit > > I had Py 2.5 installed on my PC earlier this year, and it began failing > around June. I finally uninstalled it, and tried 2.6. Still had problems > that centered around getting to IDLE. Uninstalled 2.6, and went to 2.7. >

Re: [Tutor] Need Explanation...

2011-12-12 Thread James Reynolds
Sent from my iPad On Dec 12, 2011, at 7:08 AM, "Homme, James" wrote: > Hi, > Alan said: > Because app() returns the result of append(). > But append() returns None, since it modifies the list in place. > > This is one of the few features of Python I dislike. It would not have been > difficul

Re: [Tutor] print method name

2011-12-08 Thread James Reynolds
On Thu, Dec 8, 2011 at 9:49 AM, rail shafigulin wrote: > i created a class and in some instances when i use it call some of its > methods i need to print a method name. the online search did produce some > results but none of them seem to work for me. for example one of them said > just to use __n

Re: [Tutor] pass tuples to user defined function(beginner)

2011-11-28 Thread James Reynolds
On Mon, Nov 28, 2011 at 12:32 PM, Mayo Adams wrote: > I am trying to pass a set of tuple strings from a file to a function I > have defined. Each tuple is on a separate line, and looks something > like this: > ('note',2048) > The function has two parameters , and is defined thus: def > findinde

Re: [Tutor] How to shorten this code using classes?

2011-11-23 Thread James Reynolds
On Wed, Nov 23, 2011 at 10:35 AM, Mic wrote: > Hi. > I have written a simple GUI program. It works just like it is intended to > do, but there > is a problem, I feel like I could make it shorter. I thought of using > classes instead of > doing it the way I have done. > > Here is my code: > > from

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread James Reynolds
On Tue, Nov 22, 2011 at 12:28 AM, John wrote: > > Hi all, > > I have wriiten the following code: > [Segment] > > def survivor(names, step): >>>index = step - 1 >next = names >while len(next)> 1: >next.remove (next[index]) > > > > However when ever i run it i get this e

Re: [Tutor] list of objects?

2011-11-15 Thread James Reynolds
On Tue, Nov 15, 2011 at 8:40 AM, Elwin Estle wrote: > I am attempting to write a text based spider solitaire game. I have a > pretty simple card class, and a deck class, which has a list of card > objects, which are shuffled, then individual elements are put into > self.dealt, which is a 'list o

Re: [Tutor] range question

2011-09-22 Thread James Reynolds
On Thu, Sep 22, 2011 at 11:08 AM, Steven D'Aprano wrote: > Joel Knoll wrote: > >> Given a range of integers (1,n), how might I go about printing them in the >> following patterns: >> 1 2 3 4 ... n2 3 4 5 ... n 13 4 5 6 ... n 1 2 etc., e.g. for a "magic >> square". So that for the range (1,5) for e

Re: [Tutor] range question

2011-09-22 Thread James Reynolds
On Thu, Sep 22, 2011 at 10:27 AM, Joel Knoll wrote: > Given a range of integers (1,n), how might I go about printing them in the > following patterns: > > 1 2 3 4 ... n > 2 3 4 5 ... n 1 > 3 4 5 6 ... n 1 2 > > etc., e.g. for a "magic square". So that for the range (1,5) for example I > would ge

Re: [Tutor] databases

2011-09-10 Thread James Reynolds
On Sat, Sep 10, 2011 at 3:39 PM, Andre' Walker-Loud wrote: > Hi All, > > I am completely new to databases as well as using python to access/create > databases. I started googling about it and found so much info, I wasn't > sure where to begin to answer my first question. So I thought I would que

Re: [Tutor] need advice about a dictionary ({})

2011-09-08 Thread James Reynolds
On Thu, Sep 8, 2011 at 10:03 AM, Alan Gauld wrote: > On 08/09/11 11:58, Richard D. Moores wrote: > >> I've succeeded in writing a dictionary ({}) that I can use as a small >> personal phone book. The dictionary (very shortened and simplified) >> looks like this in the script; >> >> p = {} >> >> p[

Re: [Tutor] 'function' object has no attribute 'writer'

2011-09-05 Thread James Reynolds
On Mon, Sep 5, 2011 at 12:08 PM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > I want to write a csv file, but I need the final user to give me some > values to open and update the file. My code is: > from Tkinter import * #Llamo las librerias graficas de Tk > import tk

Re: [Tutor] Is there a test for hashability?

2011-09-01 Thread James Reynolds
On Thu, Sep 1, 2011 at 11:37 AM, Hugo Arts wrote: > On Thu, Sep 1, 2011 at 5:28 PM, Richard D. Moores > wrote: > > Thanks, James, from your ideas I've come up with this function as a > > general test for hashibility of any object: > > > > def is_hashable(object): > >try: > >if hash(o

Re: [Tutor] Is there a test for hashability?

2011-09-01 Thread James Reynolds
On Thu, Sep 1, 2011 at 10:32 AM, Richard D. Moores wrote: > The glossary defines "hashable" as: > > hashable > An object is hashable if it has a hash value which never changes > during its lifetime (it needs a __hash__() method), and can be > compared to other objects (it needs an __eq__() method)

Re: [Tutor] help with 'organization'

2011-08-25 Thread James Reynolds
On Thu, Aug 25, 2011 at 1:51 PM, John wrote: > Hello, I am writing a module that will have two classes ('runners') I > am calling them, as they will ultimately use subprocess to run a > command line program, so they are basically option parsers, etc... > > As I wrote the second 'runner', I realiz

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
On Tue, Aug 23, 2011 at 4:11 PM, James Reynolds wrote: > > > On Tue, Aug 23, 2011 at 3:49 PM, Emile van Sebille wrote: > >> On 8/23/2011 12:31 PM James Reynolds said... >> >> I'm trying the 7-zip solution, but I can't get past this >>> error: W

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
On Tue, Aug 23, 2011 at 3:49 PM, Emile van Sebille wrote: > On 8/23/2011 12:31 PM James Reynolds said... > > I'm trying the 7-zip solution, but I can't get past this >> error: WindowsError: [Error 2] The system cannot find the file specified >> >

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
On Tue, Aug 23, 2011 at 2:57 PM, Alan Gauld wrote: > On 23/08/11 19:23, James Reynolds wrote: > >> I tried that already. >> >> that's only to set the default password to read the zip, not to set a >> pasword (wording is misleading I think) >> >> >

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
I tried that already. that's only to set the default password to read the zip, not to set a pasword (wording is misleading I think) On Tue, Aug 23, 2011 at 1:42 PM, Emile van Sebille wrote: > On 8/23/2011 10:19 AM James Reynolds said... > > Does anyone know if a way to password

[Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
Does anyone know if a way to password protect a zip file? I have no issues creating the zip file, but I would like to password protect as well. I'm aware of a commercial solution, but I would like something open source. ___ Tutor maillist - Tutor@python

Re: [Tutor] converting string to float

2011-08-10 Thread James Reynolds
On Wed, Aug 10, 2011 at 3:16 PM, Shwinn Ricci wrote: > I am reading values from excel using xlrd and using a variable to store > them in (as part of a loop), as such: > > position = sheet.cell(j, i).value > > however, I want to convert position to a floating point number, as the > actual cell va

[Tutor] Fwd: KeyError?

2011-07-28 Thread James Reynolds
-- Forwarded message -- From: Shwinn Ricci Date: Thu, Jul 28, 2011 at 1:13 PM Subject: Re: [Tutor] KeyError? To: James Reynolds On Thu, Jul 28, 2011 at 12:42 PM, James Reynolds wrote: > > > On Thu, Jul 28, 2011 at 12:11 PM, Prasad, Ramit > wrote: > >>

Re: [Tutor] KeyError?

2011-07-28 Thread James Reynolds
On Thu, Jul 28, 2011 at 12:11 PM, Prasad, Ramit wrote: > *From:* tutor-bounces+ramit.prasad=jpmchase@python.org [mailto: > tutor-bounces+ramit.prasad=jpmchase@python.org] *On Behalf Of *Shwinn > Ricci > *Sent:* Thursday, July 28, 2011 10:51 AM > *To:* tutor@python.org > *Subject:* [Tutor]

Re: [Tutor] KeyError?

2011-07-28 Thread James Reynolds
On Thu, Jul 28, 2011 at 11:50 AM, Shwinn Ricci wrote: > I have an excel file that I am reading cell values from and putting them > into a dictionary. the dictionary looks like this: > > scafPositions = {position[j]: direction[j]} > > where position[j] is exclusively floating/numerical values and

Re: [Tutor] Object Management

2011-07-27 Thread James Reynolds
On Wed, Jul 27, 2011 at 9:51 AM, Alexander wrote: > Hello everyone. I'm having trouble wrapping my mind around a project I'm > working on. My goal is to create a program that manages (allows its users to > manipulate, search by criteria and edit) objects. There is one type of > object, for exampl

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread James Reynolds
I just use string{0}.format(arg) format and that solves needing to memorize % whatevers. On Sat, Jul 23, 2011 at 11:08 AM, Martin A. Brown wrote: > > Hello everybody, > > : > Hello! I'm having troubles understanding what is the difference > between %s > : > and %r(format characters). I did goog

Re: [Tutor] Question regarding xml.dom.minidom: How do you send an unsignedByte in an wsdl request

2011-07-22 Thread James Reynolds
On Fri, Jul 22, 2011 at 2:18 PM, Garry Bettle wrote: > Howdy all, > > Hope this message finds everyone well - roll on the weekend! > > I'm trying some calls to an wsdl API I've subscribed to. > > But I'm struggling to know what they want when sending an unsignedByte in a > request. > > I'm using x

Re: [Tutor] Viability of Python

2011-07-21 Thread James Reynolds
Source files for the 3.2 branch are located here: http://hg.python.org/cpython/file/f0475f78d45c the modules and objects directory has a lot of c files. there some elsewhere. In modules theres some that start with XX. those are demonstration i believe. On Thu, Jul 21, 2011 at 6:46 PM, Prasad, Ra

Re: [Tutor] Stack problem usind Python2.6

2011-07-21 Thread James Reynolds
On Thu, Jul 21, 2011 at 5:16 PM, David Merrick wrote: > ##from stack import Stack > > class Stack: > def __init__(self): > self.items =[] > > def isEmpty(self): > return self.items ==[] > > def push(self,item): > self.items.append(item) > > def pop(self,ite

Re: [Tutor] Stack problem usind Python2.6

2011-07-21 Thread James Reynolds
On Thu, Jul 21, 2011 at 5:16 PM, David Merrick wrote: > ##from stack import Stack > > class Stack: > def __init__(self): > self.items =[] > > def isEmpty(self): > return self.items ==[] > > def push(self,item): > self.items.append(item) > > def pop(self,ite

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread James Reynolds
Thanks for the input. I received another email off list and I think i'm going to look into " Textastic". The Cloud9 seems interesting, but I'm not assured to have internet access all the time (even if I do live in NYC). Thanks for all the replies! On Thu, Jul 21, 2011 at 5:09 PM, ian douglas w

Re: [Tutor] Removing characters in a string using format()

2011-07-21 Thread James Reynolds
Since you're using python 3, you can just use a star to unpack the list like so: >>> print(*x) a b >>> print(*x, sep = ', ') a, b You can use sep to change the separator if you want the commas still. On Thu, Jul 21, 2011 at 1:53 PM, Ryan Porter wrote: > Hi there, > > In one part of a program

[Tutor] Python editor for Ipad

2011-07-21 Thread James Reynolds
I might have to discuss some routines I've written in Python (and possibly C). It would be easier to whip out the Ipad and show them some of the things I've done, rather than a bulky laptop. I could of course PDF everything with highlighting off of eclipse, but ideally Ideally I would prefer a way

Re: [Tutor] Web Programming

2011-07-20 Thread James Reynolds
If it doesn't interest you, skip it and move on. You can always come back and learn it later, which will be easier anyway, with a more robust background. On Wed, Jul 20, 2011 at 11:22 AM, Dharmit Shah wrote: > Hi all, > > I have been reading Head First > Python

Re: [Tutor] getting error while solving a series that estimates the value of pi

2011-07-18 Thread James Reynolds
On Mon, Jul 18, 2011 at 12:10 PM, surya k wrote: > Hi, > > The problem is to estimate the value of pi using the following series. > *1 / pi = (( 2 * sqrt(2) )/ 9801 ) * SIGMA of k[ (4k)! (1103 + 26390*k) > / (k!^ 4 ) * 396^(4k) ]* > *where k is [0, infinity)* > * Problem is located at : Think

Re: [Tutor] Reading opened files

2011-06-17 Thread James Reynolds
Your problem is right here: >>> whole=file.read >>> print whole Your re-assigning the method "read()", which is a method of the object "file" to the variable "whole" So, when you print "whole" you can see that it is printing the location of the method in memory. If you were to print file.read yo

Re: [Tutor] File parsing

2011-06-16 Thread James Reynolds
use split on the list to split it up. search each element for something like: if '"' == element[:-1]: if that evaluation is True, I would remove the quote mark from the word on the right side, and place a new one on the left side using something like '"' + element. I would do the same thing for

Re: [Tutor] step value

2011-06-15 Thread James Reynolds
I am copying and pasting your code here from the previous email: def ask_number(question, low, high): > """Ask for a number within a range.""" > response = None > if response in range(low, high, 1): > return response > while response not in range(low, high): > respon

Re: [Tutor] Step Value

2011-06-15 Thread James Reynolds
Without looking at your code, What is it that you know that's wrong about it? Are you getting a return value which you know is incorrect, is the program throwing error and you aren't sure why? or do you just suspect it is wrong but you aren't sure? When posing a question, it's helpful to know the

Re: [Tutor] Break stament issue

2011-06-14 Thread James Reynolds
On Tue, Jun 14, 2011 at 2:59 PM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > Hello members! > > I'm doing a script that needs to loop to get some information, in order to > do that I'm using modules from OGR and Mapnik. These to get data from > shapefiles, but some of

Re: [Tutor] Medical Decision-Making Question

2011-06-13 Thread James Reynolds
I would start by getting a lot of the parameters you need in a database such as SQLite (comes with python). So for example, you would have a disease with known symptoms. You could structure your tables with diseases symptoms So, say the disease is a cold in the table you will have a row for cold

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-10 Thread James Reynolds
Honestly no idea. At work I use 2.6 / 2.7. At home it's 3.2 / 2.7. I've never actually tried doing this at home, so I don't know. They have a mail list though, I would post there to find out. 2011/6/10 Válas Péter > > > 2011. június 10. 15:51 James Reynolds írta,

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-10 Thread James Reynolds
> > 3) Open the .txt file in Excel, remove the few lines I don't need (ie > single quotes, etc) Regarding Excel, you can write your output directly to an Excel file from python using the Python-Excel module. Just install all three packages. I use them all the time. Here is something that I wrote

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-09 Thread James Reynolds
My advice would be to stay away from generic names, like: for item in items: do stuff with item For a couple of lines its ok, but when programs get large, your program will get confusing even to you as the author. Sometimes, it's best just to do "for all in listx: but I think that's rare. Us

Re: [Tutor] Python Extensions in C

2011-06-02 Thread James Reynolds
find if they > > are all together. > > Other than that I can't see the error, but its late and thats > quite a lot of code for a Python programmer to wade through! :-) > > > Alan Gauld > Author of the Learn To Program website > > http://www.alan-g.me.uk/ > > > --

Re: [Tutor] Python Extensions in C

2011-06-01 Thread James Reynolds
s: There are three parameters now, not one. The later two are optional. they are (list, avg, and sample) sample is True by default. So you can pass it an average already. Lastly, any other pointers would be greatly appreciated. James On Thu, May 26, 2011 at 7:50 PM, Alan Gauld wrote:

Re: [Tutor] checking if a variable is an integer?

2011-05-31 Thread James Reynolds
If prime numbers were finite (an ability to find *all *prime numbers) that would cause havoc with the fundamental theorem of arithmetic ;) On Tue, May 31, 2011 at 5:40 PM, Rachel-Mikel ArceJaeger < arcejae...@gmail.com> wrote: > Isn't one of the unsolved millenium prize problems one that includes

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
On Thu, May 26, 2011 at 3:07 PM, Stefan Behnel wrote: > Stefan Behnel, 26.05.2011 18:10: > > James Reynolds, 26.05.2011 17:22: >> >>> As an intellectual exercise, I wanted to try my hand at writing some >>> extensions in C. >>> >> >> This

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
at 1:52 PM, Patty wrote: > > - Original Message - From: "Stefan Behnel" > To: > Sent: Thursday, May 26, 2011 9:10 AM > Subject: Re: [Tutor] Python Extensions in C > > > > James Reynolds, 26.05.2011 17:22: >> >>> As an intellectual exercise, I want

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Thank you Rachel and Alan for the feedback. Oddly enough, I had created an exception between the time I sent this and your response to catch occasions when the list is empty (I will need to test a few other things, like what if the list holds items other than strictly numbers?) I did utilize some

[Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Hello All: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. I was wondering if you all could look over my code and give some feedback. Here is the link for the code: http://pastebin.com/jw3ihfsN I have zero experience coding in C (and not much more coding in

Re: [Tutor] Making a script part of the terminal

2011-05-20 Thread James Reynolds
We just had a similar question yesterday. Just make sure Python is on your PATH. CD to the directory where your file is located and then you can just type "python myfile.py" where myfile is the name of your file. On Fri, May 20, 2011 at 1:43 PM, michael scott wrote: > Okay, my title might be und

Re: [Tutor] Error in executing 'Python Filename.py'.

2011-05-19 Thread James Reynolds
You're in the python interpreter. Hit control C to go back to cmd and then you can do "python hello.py" On Thu, May 19, 2011 at 4:14 PM, Neha P wrote: > C:\>python hello.py > 'python' is not recognized as an internal or external command, > operable program or batch file. > > C:\>cd python26 > >

Re: [Tutor] String Processing Query

2011-05-16 Thread James Reynolds
concatenate the entire thing together, including the "*". Once you have that as a single string, use string.split('*') and you will have your two strings. On Mon, May 16, 2011 at 9:51 AM, Spyros Charonis wrote: > I have a file with the following contents: > > >from header1 > abcdefghijkl > mnopq

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
Yes, thank you. Actually, I never knew that about the windows separators, since I've just always used the '\' out of habit. On Wed, May 11, 2011 at 2:39 PM, Prasad, Ramit wrote: > > > >your "\" is a "/" > > > > >when writing out a string, such as 'C:\test.xls', the "/" is an escape in > python

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
line 634, in save > doc.save(filename, self.get_biff_data()) > File "C:\Python26\lib\site-packages\xlwt\Workbook.py", line 615, in > get_biff_data > self.__worksheets[self.__active_sheet].selected = True > IndexError: list index out of range > > Thanks &

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
Slow day at work, so I tried something a little different mostly as a learning exercise for myself, let me know what you all think. I thought it would be useful to have a writer that scales and that organizes the data. For example, you might have 20 tests one day, and 5 the next. I broke up the d

Re: [Tutor] how to develop a python exe file in windows using python3.1

2011-04-14 Thread James Reynolds
We literally just answered this question a couple days ago, but if you need to make an executable in 3.1, CX freeze i believe should work. On Thu, Apr 14, 2011 at 9:42 AM, ema francis wrote: > I am using python3.1 in windows environment.How can I create a python > executable file? > I tried with

Re: [Tutor] Python 3.2 - Running in Idle but not in command window

2011-04-13 Thread James Reynolds
Oh, belay my last, I misread the question. My apologies. On Wed, Apr 13, 2011 at 1:04 PM, James Reynolds wrote: > I double clicked it from my desktop and it opens just fine (though I didn't > attempt to run it, because I have 2.6 on my work machine and I'm sure that > wi

Re: [Tutor] Python 3.2 - Running in Idle but not in command window

2011-04-13 Thread James Reynolds
I double clicked it from my desktop and it opens just fine (though I didn't attempt to run it, because I have 2.6 on my work machine and I'm sure that will cause it to fail). Have you added python to Path environment variables in windows? On Wed, Apr 13, 2011 at 11:14 AM, Gary Beynon wrote: > -

Re: [Tutor] Retrieve data

2011-04-12 Thread James Reynolds
NYtimes has an API http://developer.nytimes.com/ No clue on how well it works or even if the weather is in the API. Looks like a lot of fluff, like comments and such. At any rate, maybe you can request they add weather to their API. On Tue, Apr 12, 2011 at 12:36 PM

Re: [Tutor] Running python on windows

2011-04-11 Thread James Reynolds
At least in my case it was about simplicity. If it was a simple matter of using a base python program, that would be one thing, but the last program i distributed here at work used pygtk as it's GUI (which at the time required four different packages, I believe they have consolidated this down to o

Re: [Tutor] Running python on windows

2011-04-11 Thread James Reynolds
I use http://cx-freeze.sourceforge.net/ personally. I found py2exe to be a headache compared to cx. On Mon, Apr 11, 2011 at 9:01 AM, Mike Silverson wrote: > Hi, I need to know if there is any way to run a python file without Python > installed on the target computer. I am trying to send a progra

Re: [Tutor] counting a list of elements

2011-04-01 Thread James Reynolds
The nice thing about Python is you don't have to build things from scratch, and I imagine most people would discourage on account of it being a waste of time, other then education value. But the "best practice" in my humble opinion would be to use the built in len function. If what you are after i

Re: [Tutor] Data frame packages

2011-03-31 Thread James Reynolds
On Thu, Mar 31, 2011 at 11:10 AM, Blockheads Oi Oi wrote: > On 31/03/2011 09:38, Ben Hunter wrote: > >> Is anybody out there familiar with data frame modules for python that >> will allow me to read a CSV in a similar way that R does? pydataframe >> and DataFrame have both befuddled me. One requir

Re: [Tutor] String formatting question.

2011-03-29 Thread James Reynolds
On Tue, Mar 29, 2011 at 4:21 PM, Corey Richardson wrote: > On 03/29/2011 03:41 PM, Prasad, Ramit wrote: > > Is there a difference (or preference) between using the following? > > "%s %d" % (var,num) > > VERSUS > > "{0} {1}".format(var,num) > > > > > > Ramit > > If you're using Python 3, use the s

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread James Reynolds
On Fri, Mar 25, 2011 at 7:52 AM, Robert Sjoblom wrote: > Hi again, list! A quick question about dictionary behaviour. I have a > dictionary of keys, and the user should be able to enter values into > said dictionary. My idea was this: > > def addData(key, value): >dictionary[key] += int(value)

Re: [Tutor] Saving information for my program

2011-03-21 Thread James Reynolds
On Mon, Mar 21, 2011 at 11:11 AM, michael scott wrote: > I apologize now but I'm going to be spamming the tutor list as I have just > decided to create an extremely ambitious project for someone of my level. > Anyhow, I will start with my first question. > > How do I save user created information

Re: [Tutor] Processing Financial Calculations using Python

2011-03-16 Thread James Reynolds
For all of these, I wrote my own class with methods to create the correct output. there is not built in python functionality that I know, although there may be a package. For IRR, the method expects a list and at least one negative value. I believe the way I did NPV was a dictionary, where the key

  1   2   >