Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
My apatite having been whetted I'm now stymied because of a Ubuntu dependency problem during the installation of urllib3. This is listed as a bug. Has anyone overcome this problem? Perhaps there's another library that I can use to download data from a web page? -- Regards, Phil _

Re: [Tutor] model methods in Django

2013-05-18 Thread eryksun
On Sat, May 18, 2013 at 10:22 PM, Dave Angel wrote: > The pub_date is probably an instance attribute of either the Poll class or > the models.Model class. It should probably be defined in the appropriate > __init__ method. In any case it's not a method attribute. Django uses function attributes

Re: [Tutor] creating import directories

2013-05-18 Thread Steven D'Aprano
On 19/05/13 14:08, Jim Mooney wrote: I'm a bit unclear about creating import directories. The terminology you want here is "import packages". You cannot import directories. You can only import modules and packages. "Module" in Python has two meanings: 1) a module is a file containing Python

[Tutor] creating import directories

2013-05-18 Thread Jim Mooney
I'm a bit unclear about creating import directories. I can import something like the json directory from Lib with a simple import json So I tried putting my own directory in Lib, called bagofries, as a test, and put a simple printstuff.py program in it. But when I try to import bagofries, I get

[Tutor] WAMP stack

2013-05-18 Thread Jim Mooney
I noticed someone mentioned WAMP stacks but didn't see the answer. I use a WAMP stack a lot. It has PHP. But I used it mainly with PHP CMS. How do I install Python into my WAMP stack, and does that make any sense for just raw Python, or only if I want to load Django or something web-oriented and te

Re: [Tutor] model methods in Django

2013-05-18 Thread Dave Angel
On 05/18/2013 03:16 PM, Matthew Ngaha wrote: im following the official docs and after learning Python im sure of how methods work, but the model example on the beginners guide which official docs? URLs please? which beginners guide? URL please? has me really confused. I don't know Djan

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Steven D'Aprano
On 19/05/13 02:45, Albert-Jan Roskam wrote about locales: It is pretty sick that all these things can be adjusted separately (what is the use of having: danish collation, russian case conversion, english decimal sign, japanese codepage ;-) Well obviously there is no point to such a mess, but

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 22:44, Peter Otten wrote: You can use a tool like lxml that "understands" html (though in this case you'd need a javascript parser on top of that) -- or hack something together with string methods or regular expressions. For example: import urllib2 import json s = urllib2.urlopen("h

Re: [Tutor] Python web script to run a command line expression

2013-05-18 Thread William Ranvaud
I'm not sure if this is what you are looking for or if this will work on WAMP but python has a virtual terminal emulator called Vte or python-vte. I use it to display the terminal and run commands. I'm using it on Linux by adding "from gi.repository import Vte". Hope it helps. On 18-05-2013

[Tutor] model methods in Django

2013-05-18 Thread Matthew Ngaha
im following the official docs and after learning Python im sure of how methods work, but the model example on the beginners guide has me really confused. The model definition is omitted but can anyone explain how this methed (was_published_recently) is given these attributes: class Poll(models.

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread eryksun
On Sat, May 18, 2013 at 12:45 PM, Albert-Jan Roskam wrote: > > It seems that the result of str.isalpha() and str.isdigit() *might* be > different depending > on the setting of locale.C_CTYPE. Yes, str() in 2.x uses the locale predicates from : http://pubs.opengroup.org/onlinepubs/9699919799/bas

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Walter Prins
Hi Just a minor observation: On 18 May 2013 13:44, Peter Otten <__pete...@web.de> wrote: > Phil wrote: > > > On 18/05/13 19:25, Peter Otten wrote: > >> > >> Are there alternatives that give the number as plain text? > > > > Further investigation shows that the numbers are available if I view the

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Albert-Jan Roskam
> >> East Asian languages. But later on Joel Spolsky's "standard" > page about unicode >> I read that it goes to 6 bytes. That's what I implied when I mentioned > "utf8". > > Each surrogate in a UTF-16 surrogate pair is 10 bits, for a total of > 20-bits. Thus UTF-16 sets the upper bound on

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread eryksun
On Sat, May 18, 2013 at 6:01 AM, Albert-Jan Roskam wrote: > > East Asian languages. But later on Joel Spolsky's "standard" page about > unicode > I read that it goes to 6 bytes. That's what I implied when I mentioned "utf8". Each surrogate in a UTF-16 surrogate pair is 10 bits, for a total of 20

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Peter Otten
Phil wrote: > On 18/05/13 19:25, Peter Otten wrote: >> >> Are there alternatives that give the number as plain text? > > Further investigation shows that the numbers are available if I view the > source of the page. So, all I have to do is parse the page and extract > the drawn numbers. I'm not s

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Steven D'Aprano
On 18/05/13 20:01, Albert-Jan Roskam wrote: Thanks for all your replies. I knew about code points, but to represent the unicode string (code point) as a utf-8 byte string (bytes), characters 0-127 are 1 byte (of 8 bits), then 128-255 (accented chars) are 2 bytes, and so on up to 4 bytes for Ea

Re: [Tutor] Unsubscribe

2013-05-18 Thread Dave Angel
On 05/16/2013 12:58 PM, Stafford Baines wrote: I only intend this to be temporary. I'm going away for a couple of weeks and don't want my mailbox overflowing when I return.😃 Thanks for all the help Sent from my iPhone ___ Tutor maillist - Tutor@pyth

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 19:25, Peter Otten wrote: Are there alternatives that give the number as plain text? Further investigation shows that the numbers are available if I view the source of the page. So, all I have to do is parse the page and extract the drawn numbers. I'm not sure, at the moment, how

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 19:25, Peter Otten wrote: What's the url of the page? http://tatts.com/goldencasket Are there alternatives that give the number as plain text? Not that I can find. A Google search hasn't turned up anything. If not, do the images have names like whatever0.jpg, whatever1.jpg, w

Re: [Tutor] use python to change the webpage content?

2013-05-18 Thread Albert-Jan Roskam
>There is a online simulator about a physic project I'm doing and I want to use >the data the simulator generates on that website. I can get data using >urllib.request and regular expression but I also want to change some of the >input values and then get different sets of data. However, if I

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: tutor@python.org > Cc: > Sent: Saturday, May 18, 2013 5:28 AM > Subject: Re: [Tutor] why is unichr(sys.maxunicode) blank? > > On Fri, May 17, 2013 at 11:06 PM, Dave Angel wrote: >> One tool that can help is the name function in module unico

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Albert-Jan Roskam
>> I was curious what the "high" four-byte ut8 unicode characters look like. > >By the way, your sentence above reflects a misunderstanding. Unicode >characters (strictly speaking, code points) are not "bytes", four or >otherwise. They are abstract entities represented by a number between 0 an

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Peter Otten
Phil wrote: > On 18/05/13 16:33, Alan Gauld wrote: >> On 18/05/13 00:57, Phil wrote: >>> I'd like to "download" eight digits from a web site where the digits are >>> stored as individual graphics. Is this possible, using perhaps, one of >>> the countless number of Python modules? Is this the funct

Re: [Tutor] Retrieving data from a web site

2013-05-18 Thread Phil
On 18/05/13 16:33, Alan Gauld wrote: On 18/05/13 00:57, Phil wrote: I'd like to "download" eight digits from a web site where the digits are stored as individual graphics. Is this possible, using perhaps, one of the countless number of Python modules? Is this the function of a web scraper? In

[Tutor] Python web script to run a command line expression

2013-05-18 Thread Ahmet Anil Dindar
Hi, I have a WAMP running in my office computer. I wonder how I can implement a python script that runs within WAMP and execute a command line expression. By this way, I will able to run my command line expressions through web page in intranet. I appreciate your suggestions. ++Ahmet _