Re: [Tutor] list mail formatting

2011-12-22 Thread Jamie Paul Griffin
On Wed, Dec 21, 2011 at 11:51:46PM +, Alan Gauld wrote:
> On 21/12/11 11:49, Jamie Paul Griffin wrote:
 
> >Is there not a requirement to use plain text as with
> > most other technical mailing lists?
> 
> No, because many of the users of this list are non technical
> beginners who understand relatively little about computers.
> We  request, and advise where possible, on setting up email
> in plain text, but we do not insist since that would deter
> the very people we are trying to help.

I can understand that and it's a fair point. So, perhaps my suggestion of 
putting some filtering/reformatting software on the list server could help with 
this?

jamie.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list mail formatting

2011-12-22 Thread Alan Gauld

On 22/12/11 03:34, Alexander wrote:


We  request, and advise where possible, on setting up email
in plain text, but we do not insist



It's a frustration to most folks who were brought up on
plain-text email.


I'm glad I came across this thread. I've been following a few posts
here and there, and now that Alan has posted I feel comfortable
exchanging emails for this mailing list from here on in rich
formatting.


Notice I didn't say we encourage it. If you can send mails in plain 
tesxt you will avoid many problems, particularly in code formatting 
issues. You will also avoid frustrating those who might help you.


But, if you can't figure out how to send in plain text we would rather 
you posted RTF than not post at all!


But if you ever want to grow as a programmer and use any of the more 
advanced technical mailing lists you will find them less accomodating.
So avoiding plain text may work here but will ultimately be limiting to 
your learning.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list mail formatting

2011-12-22 Thread Alan Gauld

On 22/12/11 08:59, Jamie Paul Griffin wrote:


I can understand that and it's a fair point.

> So, perhaps my suggestion of putting some filtering/reformatting
> software on the list server could help with this?

Maybe, but I'm a list moderator and I have absolutely no access
to the list server installation, I just use the web admin interface.
I don't even know who does have access to the server installation.
It's probably someone at the python.org admin level.

So how we would ever do that I have no idea!

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list mail formatting

2011-12-22 Thread Alexander Etter

On Dec 22, 2011, at 4:10, Alan Gauld  wrote:

> On 22/12/11 03:34, Alexander wrote:
> 
>>> We  request, and advise where possible, on setting up email
>>> in plain text, but we do not insist
> 
>>> It's a frustration to most folks who were brought up on
>>> plain-text email.
>> 
>> I'm glad I came across this thread. I've been following a few posts
>> here and there, and now that Alan has posted I feel comfortable
>> exchanging emails for this mailing list from here on in rich
>> formatting.
> 
> Notice I didn't say we encourage it. If you can send mails in plain tesxt you 
> will avoid many problems, particularly in code formatting issues. You will 
> also avoid frustrating those who might help you.
> 
> But, if you can't figure out how to send in plain text we would rather you 
> posted RTF than not post at all!
> 
> But if you ever want to grow as a programmer and use any of the more advanced 
> technical mailing lists you will find them less accomodating.
> So avoiding plain text may work here but will ultimately be limiting to your 
> learning.
> 
> -- 
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> 
> __

Ah I know of what you mentioned. On an GNU Emacs mailing list I was advised to 
avoid anything but plaintext. 
It just seems so archaic. But I'm a novice and will learn why eventually. 
Alexander.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list mail formatting

2011-12-22 Thread Jamie Paul Griffin
On Thu, Dec 22, 2011 at 09:14:57AM +, Alan Gauld wrote:
> On 22/12/11 08:59, Jamie Paul Griffin wrote:
> 
> >I can understand that and it's a fair point.
> > So, perhaps my suggestion of putting some filtering/reformatting
> > software on the list server could help with this?
> 
> Maybe, but I'm a list moderator and I have absolutely no access
> to the list server installation, I just use the web admin interface.
> I don't even know who does have access to the server installation.
> It's probably someone at the python.org admin level.
> 
> So how we would ever do that I have no idea!

No problem. I'll write something to reformat these emails on my server, saves 
any bother. Thank you for humouring me.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list mail formatting

2011-12-22 Thread prakash singh
i am  asking a code how to fill the column of username and password
with letters and press enter after that anyone who can help me on that
thanks for the replies ,please provide me so that i can automate the
rest part of the router gui

On Thu, Dec 22, 2011 at 3:23 PM, Alexander Etter  wrote:
>
> On Dec 22, 2011, at 4:10, Alan Gauld  wrote:
>
>> On 22/12/11 03:34, Alexander wrote:
>>
 We  request, and advise where possible, on setting up email
 in plain text, but we do not insist
>>
 It's a frustration to most folks who were brought up on
 plain-text email.
>>>
>>> I'm glad I came across this thread. I've been following a few posts
>>> here and there, and now that Alan has posted I feel comfortable
>>> exchanging emails for this mailing list from here on in rich
>>> formatting.
>>
>> Notice I didn't say we encourage it. If you can send mails in plain tesxt 
>> you will avoid many problems, particularly in code formatting issues. You 
>> will also avoid frustrating those who might help you.
>>
>> But, if you can't figure out how to send in plain text we would rather you 
>> posted RTF than not post at all!
>>
>> But if you ever want to grow as a programmer and use any of the more 
>> advanced technical mailing lists you will find them less accomodating.
>> So avoiding plain text may work here but will ultimately be limiting to your 
>> learning.
>>
>> --
>> Alan G
>> Author of the Learn to Program web site
>> http://www.alan-g.me.uk/
>>
>> __
>
> Ah I know of what you mentioned. On an GNU Emacs mailing list I was advised 
> to avoid anything but plaintext.
> It just seems so archaic. But I'm a novice and will learn why eventually.
> Alexander.
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] username/password question [was Re: list mail formatting]

2011-12-22 Thread Alan Gauld

On 22/12/11 11:06, prakash singh wrote:

i am  asking a code how to fill the column of username and password
with letters and press enter after that anyone who can help me on that
thanks for the replies ,please provide me so that i can automate the
rest part of the router gui


Please do not hijack a thread by just replying to an existing email.
This conceals your message on threaded mail/news readers and makes it 
less likely you will get a reply.
It is also confusing for readers trying to sesarch the archives in the 
future.


Always start a new subject with a new message. And change the subject 
line to reflect the true subject.


Now, as to your question can you give us a bit more context?
What column of username/password? What kind of GUI?
Is this web based or desktop based?

Are you trying to screen-scrape an existing GUI or are you trying to 
create a new GUI?


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list mail formatting

2011-12-22 Thread Steven D'Aprano

prakash singh wrote:

i am  asking a code how to fill the column of username and password
with letters and press enter after that anyone who can help me on that
thanks for the replies ,please provide me so that i can automate the
rest part of the router gui


Everything you need to know to solve this problem can be learned from this 
website:


http://catb.org/~esr/faqs/smart-questions.html


Good luck!



--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Wayne Watson

Hi, Walter.

On 12/21/2011 8:20 PM, Walter Prins wrote:

Hi Wayne,

On 22 December 2011 03:21, Wayne Watson  wrote:

I uninstalled Uniblue, but as it turns out, it
was an incomplete uninstall.  I just spent the last 30-45 minutes trying to
get it uninstalled. Finally, I sent an e-mail on how to do it. I have no
idea how it got entangled with Python 2.6. So for the time being it's out of
the picture.

Well, presumably it uses/depends on Python 2.6...
I'm looking at the Uniblue DriverScanner, and see mostly exe files, and 
a few dll files.  They may all relate to the uniblue program itself.  
There's a language folder there, and a x64 folder there. x64 has the 
installer. Otherwise, there is no reference to anything that looks like 
a 26 dll, nor is there a list of drivers the program might want to 
examine for age.  Of course, all of this should have been uninstalled.


Although, the Win7 indexed search is very fast to find something there 
are times when it flubs (possibly since I don't know all the tricks one 
can use in a search). looking for 26.dll has turned up nothing an either 
a folder or inside a file. Supposedly, Uniblue supply an answer in 24 
hours. If not, I'll try Winamp.

As a question asked by others, is Python27 under ...\System32. It is under
C:\Python27.  Further, it is the 64-bit version associated with Python.

I didn't ask.  I stated, and to clarify: When you install the standard
distribution of Python, the majority of the files get put under
C:\PythonNN (unless otherwise specified by the user).  However, the
Python engine in the form of a DLL is *also* put under the System32
directory.
I'm looking at System32 entries right now. I see folders such as spool, 
speech, setup,restore, and lots of dll files.  Some of the "p" dll files 
are p2psvc.dll, packager.dll, p2p.dll, and python27.dll. No 
python26.dll, and nothing starting with py other than the 27 file.

In reading some of the other posts, I was unsure of whether Python27 is put
on the PATH or not by the install.  The question remains unanswered.  I just
left it there, as I re-installed 2.7.2 minutes ago.  Here's where matters
stand.

I've already answered this also, with an unambigious exception to my
answer pointed out by another poster, which is that it depends on
whether you installed the standard Python distribution or whether you
Standard. Interesting dependency. I considered Active once, but did not 
install it.

installed the ActiveState Python distribution.  So, did you install
the standard Python distribution or did you install the ActiveState
version of Python?  The answer to this question will determine whether
the PATH will have been affected by the Python installation.  Even so,
it's an irrelevance w.r.t. your IDLE problems...

What is the outcome based on what I wrote about not Active?



The fact that when I right click on a py file, it begins with Open and then
Edit with IDLE is very encouraging.

Having this entry in your context menu simply means certain entries
are in your system's registery but says very little else about whether
it will work or not.


The downside is that IDLE does not come up.

Which suggests that the associations/registry entries are in fact
broken, perhaps because they're pointing to a non-existent
installation of Python...

If so, how I can I tell?



However, the Start menu's Python27 entry shows Edit with IDLE, Manuals,
..., and Python Console.  The console works. The fact that IDLE actually
appears in both places is again encouraging.

Does IDLE start from the Start menu when you click it?
Nothing happens that I can detect. I'm looking at Properties of it. It 
shows

  Start in: c:\Python27.
  Type of File: shortcut (link).
 Location: ...\star menu\programs\python2.7

Interesting under the Security tab it shows Wayne with only special 
permissions. No Read, Write, Read & Execute(!!).  Admin allows all but 
special. Users allows Read&Execute and Read. Same with Everyone


Under Details tab Name is IDLE(Python GUI) link. Folder Path: 
c:\ProgramData\Microsoft\Windows\Start... I can see nothing past "Start..."



Under ...\Python27\Lib\idlelib, I can find idle.py, idle.pyw and

IdleHistory.py.  Clicking on idle.pyw does nothing.

Does double clicking idle.pyw do anything?

Nothing but a momentary circular arrow icon.  Thinking I guess.


Normally double clicking
idle.pyw will start IDLE.  Does double clicking idle.bat do anything?
Normally clicking idle.bat will also start IDLE.  If you open a
command prompt and then enter
cd \Python27\Lib\idlelib
idle.bat

Does it output any error messages? If so, what?
A black command window comes up very briefly.  It looks empty, but it's 
really gone quickly.



A few months ago when I broached this install and IDLE problem, someone
mentioned idle.bat. It is in the same  idlelib. Is there something that
needs to be done here, to get IDLE active?  Is this where having Python27 in
the path causes a problem with IDLE?

Whether or not you have C:\Python27 

Re: [Tutor] A few Python Mysteries

2011-12-22 Thread Wayne Watson



On 12/21/2011 4:10 PM, Alan Gauld wrote:

On 21/12/11 19:56, Wayne Watson wrote:


To clarify: Python on Windows does **not** put itself on the System
PATH when installed.

So, PythonNN, where NN is the version, should never appear in PATH?


Not from a standard Python installation.
But other programs whjich use Pythonn may install a version and modify 
the PATH for you, or you may, for your own benefit, add it manually.

I always add a new Python version to my PATH as a matter of course.


It's conceivable when I raised some of the questions a month of so ago,
someone suggested putting PythonNN on the path.


Very possible indeed.


likely the application that *did* put it there is the **same**
application that is now complaining about the fact that it can't find
the Python 2.5 DLL when you boot up...

See my mis-copy 26.dll in my other post to you.


OK, But the principle remains. If you have an app in your startup 
sequence that expects to find Python it will complain.
Per my new sub thread {Reset], Uniblue seems to the trouble maker with 
26.dll.


You can check your startup sequence using a Microsoft tool.
MSCONFIG or somesuch. Google Windows startup tool or similar...
You can disable individual programs and restart to find out
what is causing it.

I see msconfig.exe, but at the moment am hesitant to use it.



I have no idea why some remnant of why Python6 is hanging around. I
uninstalled it long ago too.


The problem is that it is not hanging around and some app expects
it to be there. The error message is about a missing file...

One thing that may be significant...
Are you installing your Windows Python versions from
python.org or from ActiveState? They are very similar
but not identical.

from Python Org.

--
   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

 CE 1955 October 20 07:53:32.6 UT
-- "The Date" The mystery unfolds.

Web Page:


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Wayne Watson
I just searched the registry for the dll. Nothing. I then searched for 
python. It found a a Python "folder" with a PythonCore folder. Under it 
are three folders: 2.5, 2.7 and 3.2.  I do recall installing 3.2, but 
I'm pretty sure I uninstalled it. Under each of the three folders is 
Module.  Looking at the contents shows only default (name) REG_SZ (type) 
for each. Nothing else.


OK,in scrolling around I see another Python "folder" and PythonCore 
under it, and subfolders 2.7 and 3.2.  Under 2.7 are the subfolders 
Help, InstallPath, Modules, PythonPath. For 3.2, just an empty Modules.  
All of these are under SOFTWARE. The first set of three is under 
WOW6432Node, which is under SOFTWARE.


Interesting, but it doesn't reveal much to me.

For more fun, I searched for idle. It's buried under Interface, and the 
entry is REG_SZ with value idlesettings.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] possibly a version error

2011-12-22 Thread Cranky Frankie
On the bottom of this web page:

http://developer.yahoo.com/python/python-xml.html

is a program that reads an RSS feed for the weather and then parses
the XML to show weather data by a zip code you input. I'm trying to
run this under Python 3.2 and get this error:

Traceback (most recent call last):
  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 27, in 
pprint(weather_for_zip(12303))
  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 10, in
weather_for_zip
dom = minidom.parse(urllib.urlopen(url))
AttributeError: 'module' object has no attribute 'urlopen'

I'm wondering if this is because this is Python 2.x code? Can someone
who has 2.x try to run this and let me know if that's the problem? Is
there a way to get this to work in Python 3.2?



-- 
Frank L. "Cranky Frankie" Palmeri
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Wayne Watson
More. I did some Googling on IDLE not appearing.  My case appears not to 
be unique.  One site offered this as a solution in 2.6, 
C:\Python27>python.exe \Lib\idlelib\idle.py. It issued a complaint that  
"no such file or directory exists". It however does.


A place to go that may clear this up might be 
.  I found the suggestion above there. There 
are other comments about this issue there, but I haven't sorted through 
all of them.



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] possibly a version error

2011-12-22 Thread Hugo Arts
On Thu, Dec 22, 2011 at 5:33 PM, Cranky Frankie
 wrote:
> On the bottom of this web page:
>
> http://developer.yahoo.com/python/python-xml.html
>
> is a program that reads an RSS feed for the weather and then parses
> the XML to show weather data by a zip code you input. I'm trying to
> run this under Python 3.2 and get this error:
>
> Traceback (most recent call last):
>  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 27, in 
>    pprint(weather_for_zip(12303))
>  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 10, in
> weather_for_zip
>    dom = minidom.parse(urllib.urlopen(url))
> AttributeError: 'module' object has no attribute 'urlopen'
>
> I'm wondering if this is because this is Python 2.x code? Can someone
> who has 2.x try to run this and let me know if that's the problem? Is
> there a way to get this to work in Python 3.2?
>

I usually find it helpful to check the documentation before doing
anything else when I encounter errors like this in code found online.
Right here:

http://docs.python.org/library/urllib.html

At the top of the page you should find the information you need
(you're right on the money, basically).

HTH,
Hugo
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] possibly a version error

2011-12-22 Thread Cranky Frankie
It says to use import urllib2 but I get this error:

Traceback (most recent call last):
  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 2, in 
import urllib2
ImportError: No module named urllib2

On Thu, Dec 22, 2011 at 11:41 AM, Hugo Arts  wrote:
> On Thu, Dec 22, 2011 at 5:33 PM, Cranky Frankie
>  wrote:
>> On the bottom of this web page:
>>
>> http://developer.yahoo.com/python/python-xml.html
>>
>> is a program that reads an RSS feed for the weather and then parses
>> the XML to show weather data by a zip code you input. I'm trying to
>> run this under Python 3.2 and get this error:
>>
>> Traceback (most recent call last):
>>  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 27, in 
>> 
>>    pprint(weather_for_zip(12303))
>>  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 10, in
>> weather_for_zip
>>    dom = minidom.parse(urllib.urlopen(url))
>> AttributeError: 'module' object has no attribute 'urlopen'
>>
>> I'm wondering if this is because this is Python 2.x code? Can someone
>> who has 2.x try to run this and let me know if that's the problem? Is
>> there a way to get this to work in Python 3.2?
>>
>
> I usually find it helpful to check the documentation before doing
> anything else when I encounter errors like this in code found online.
> Right here:
>
> http://docs.python.org/library/urllib.html
>
> At the top of the page you should find the information you need
> (you're right on the money, basically).
>
> HTH,
> Hugo



-- 
Frank L. "Cranky Frankie" Palmeri
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] possibly a version error

2011-12-22 Thread Cranky Frankie
I got it to work:

Use this for the import - import urllib.request

the use this: dom = minidom.parse(urllib.request.urlopen(url))

Here's the code that works in 3.2:

from pprint import pprint
import urllib.request
from xml.dom import minidom

WEATHER_URL = 'http://xml.weather.yahoo.com/forecastrss?p=%s'
WEATHER_NS = 'http://xml.weather.yahoo.com/ns/rss/1.0'

def weather_for_zip(zip_code):
url = WEATHER_URL % zip_code
dom = minidom.parse(urllib.request.urlopen(url))
forecasts = []
for node in dom.getElementsByTagNameNS(WEATHER_NS, 'forecast'):
forecasts.append({
'date': node.getAttribute('date'),
'low': node.getAttribute('low'),
'high': node.getAttribute('high'),
'condition': node.getAttribute('text')
})
ycondition = dom.getElementsByTagNameNS(WEATHER_NS, 'condition')[0]
return {
'current_condition': ycondition.getAttribute('text'),
'current_temp': ycondition.getAttribute('temp'),
'forecasts': forecasts,
'title': dom.getElementsByTagName('title')[0].firstChild.data
}

pprint(weather_for_zip(12303))

-- 
Frank L. "Cranky Frankie" Palmeri
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Alan Gauld

On 22/12/11 16:37, Wayne Watson wrote:


C:\Python27>python.exe \Lib\idlelib\idle.py. It issued a complaint that
"no such file or directory exists". It however does.


It almost certainly doesn't. The \ in front of Lib says look in the root 
directory of the C drive.


You probably need:

C:\Python27> python.exe Lib\idlelib\idle.py.

HTH

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Guidance About Installing First Python Module

2011-12-22 Thread Homme, James
Hi,
This is on Windows XP Professional.

Before asking this question, I read the tutorial at PyPi, among other things. 
By the time I was done attempting to figure out seemingly conflicting 
documentation about how to get and install Python modules, I attempted to 
deduce that I should get virtualenv.py, which would go and get some magic stuff 
that then would enable me to start to install other Python modules. I 
downloaded it and ran it. It pointed out an error, and said that this usually 
happens when someone installs Python for just their user. That was true for me. 
I uninstalled and re-installed Python, this time for all users. I noticed that 
the entire error message didn't print out, so I opened up the program and found 
the whole error message. It says this.

Note: some Windows users have reported this error when they installed Python 
for "Only this user".  The problem may be resolvable if you
install Python "For all users".  (See 
https://bugs.launchpad.net/virtualenv/+bug/352844). I went to that page and 
read some stuff that says that the program needs to find python25.dll or 
python26.dll, so I popped open Windows Find and searched for Python*.dll. I 
found  some older dll's like python25.dll and python26.dll in other folders, 
but not my Python 2.7.2 setup. I went back to the page where the bug is 
reported and clicked to see the full activity log. There was nothing about 
Python 27 in there.

How should I proceed?

Thanks.

Jim




Jim Homme,
Usability Services,
Phone: 412-544-1810.




This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed. If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it. If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Wayne Watson

Ah, yes.Thanks. That is, I think, was the what I copied from some web page.
OK, I just tried it, and got several messages.

C:\Python27>python.exe Lib\idlelib\idle.py
Traceback (most recent call last):
  File "Lib\idlelib\idle.py", line 11, in 
idlelib.PyShell.main()
  File "C:\Python27\Lib\idlelib\PyShell.py", line 1403, in main
shell = flist.open_shell()
  File "C:\Python27\Lib\idlelib\PyShell.py", line 279, in open_shell
self.pyshell = PyShell(self)
  File "C:\Python27\Lib\idlelib\PyShell.py", line 832, in __init__
OutputWindow.__init__(self, flist, None, None)
  File "C:\Python27\Lib\idlelib\OutputWindow.py", line 16, in __init__
EditorWindow.__init__(self, *args)
  File "C:\Python27\Lib\idlelib\EditorWindow.py", line 273, in __init__
self.update_recent_files_list()
  File "C:\Python27\Lib\idlelib\EditorWindow.py", line 799, in 
update_recent_files_list

rf_file = open(self.recent_files_path, 'w')
IOError: [Errno 13] Permission denied: 
'C:\\Users\\Wayne\\.idlerc\\recent-files.lst'

  -
Maybe as I pointed out a few msgs ago here the permissions shown on 
Properties looked a bit odd.




On 12/22/2011 9:58 AM, Alan Gauld wrote:

On 22/12/11 16:37, Wayne Watson wrote:


C:\Python27>python.exe \Lib\idlelib\idle.py. It issued a complaint that
"no such file or directory exists". It however does.


It almost certainly doesn't. The \ in front of Lib says look in the 
root directory of the C drive.


You probably need:

C:\Python27> python.exe Lib\idlelib\idle.py.

HTH



--
   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

 CE 1955 October 20 07:53:32.6 UT
-- "The Date" The mystery unfolds.

Web Page:


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Alan Gauld

On 22/12/11 19:08, Wayne Watson wrote:


IOError: [Errno 13] Permission denied:
'C:\\Users\\Wayne\\.idlerc\\recent-files.lst'
-
Maybe as I pointed out a few msgs ago here the permissions shown on
Properties looked a bit odd.


But the problem here is with .idlerc in your home directory.

Can you find that file and ensure that read/write permissions
are set? It may be a hidden file so you might have to tweak
the View settings.

.idelrc is presumably where Idle stores your local config settings.
Although I confess I never noticed it when I used Windows. But then I 
probably never had a need to notice it!


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] What is ™

2011-12-22 Thread bob gailer

>>> "™"
'\xe2\x84\xa2'

What is this hex string?

--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What is ™

2011-12-22 Thread Steven D'Aprano

bob gailer wrote:

 >>> "™"
'\xe2\x84\xa2'

What is this hex string?


Presumably you are running Python 2, yes? I will assume that you are using 
Python 2 in the following explanation.


You have just run smack bang into a collision between text and bytes, and in 
particular, the fact that your console is probably Unicode aware, but Python 
so-called strings are by default bytes and not text.


When you enter "™", your console is more than happy to allow you to enter a 
Unicode trademark character[1] and put it in between " " delimiters. This 
creates a plain bytes string. But the ™ character is not a byte, and shouldn't 
be treated as one -- Python should raise an error, but in an effort to be 
helpful, instead it tries to automatically encode that character to bytes 
using some default encoding. (Probably UTF-8.) The three hex bytes you 
actually get is the encoding of the TM character.


Python 2 does have proper text strings, but you have to write it as a unicode 
string:


py> s = u"™"
py> len(s)
1
py> s
u'\u2122'
py> print s
™
py> s.encode('utf-8')
'\xe2\x84\xa2'

Notice that encoding the trademark character to UTF-8 gives the same sequence 
of bytes as Python guesses on your behalf, which supports my guess that it is 
using UTF-8 by default.


If you take the three character byte string and decode it using UTF-8, you 
will get the trademark character back.


If all my talk of encodings doesn't mean anything to you, you should read this:

http://www.joelonsoftware.com/articles/Unicode.html




[1] Assuming your console is set to use the same encoding as my mail client is 
using. Otherwise I'm seeing something different to you.


--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] list issue.. i think

2011-12-22 Thread bruce
hi.

got a test where i have multiple lists with key/values. trying to figure
out how to do a join/multiply, or whatever python calls it, where i have a
series of resulting lists/dicts that look like the following..

the number of lists/rows is dynamic..
the size of the list/rows will also be dynamic as well.

i've looked over the py docs, as well as different potential solns..

psuedo code, or pointers would be helpful.

thanks...

test data
a['a1']=['a1','a2','a3']
a['a2']=['b1','b2','b3']
a['a3']=['c1','c2','c3']

end test result::
a1:a1,a2:b1,a3:c1
a1:a2,a2:b1,a3:c1
a1:a3,a2:b1,a3:c1

a1:a1,a2:b2,a3:c1
a1:a2,a2:b2,a3:c1
a1:a3,a2:b2,a3:c1

a1:a1,a2:b3,a3:c1
a1:a2,a2:b3,a3:c1
a1:a3,a2:b3,a3:c1

a1:a1,a2:b1,a3:c2
a1:a2,a2:b1,a3:c2
a1:a3,a2:b1,a3:c2

a1:a1,a2:b2,a3:c2
a1:a2,a2:b2,a3:c2
a1:a3,a2:b2,a3:c2

a1:a1,a2:b3,a3:c2
a1:a2,a2:b3,a3:c2
a1:a3,a2:b3,a3:c2

a1:a1,a2:b1,a3:c3
a1:a2,a2:b1,a3:c3
a1:a3,a2:b1,a3:c3

a1:a1,a2:b2,a3:c3
a1:a2,a2:b2,a3:c3
a1:a3,a2:b2,a3:c3

a1:a1,a2:b3,a3:c3
a1:a2,a2:b3,a3:c3
a1:a3,a2:b3,a3:c3
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list issue.. i think

2011-12-22 Thread Rich Lovely
On 23 December 2011 02:11, bruce  wrote:
> hi.
>
> got a test where i have multiple lists with key/values. trying to figure out
> how to do a join/multiply, or whatever python calls it, where i have a
> series of resulting lists/dicts that look like the following..
>
> the number of lists/rows is dynamic..
> the size of the list/rows will also be dynamic as well.
>
> i've looked over the py docs, as well as different potential solns..
>
> psuedo code, or pointers would be helpful.
>
> thanks...
>
> test data
> a['a1']=['a1','a2','a3']
> a['a2']=['b1','b2','b3']
> a['a3']=['c1','c2','c3']
>
> end test result::
> a1:a1,a2:b1,a3:c1
> a1:a2,a2:b1,a3:c1
> a1:a3,a2:b1,a3:c1
>
> a1:a1,a2:b2,a3:c1
> a1:a2,a2:b2,a3:c1
> a1:a3,a2:b2,a3:c1
>
> a1:a1,a2:b3,a3:c1
> a1:a2,a2:b3,a3:c1
> a1:a3,a2:b3,a3:c1
>
> a1:a1,a2:b1,a3:c2
> a1:a2,a2:b1,a3:c2
> a1:a3,a2:b1,a3:c2
>
> a1:a1,a2:b2,a3:c2
> a1:a2,a2:b2,a3:c2
> a1:a3,a2:b2,a3:c2
>
> a1:a1,a2:b3,a3:c2
> a1:a2,a2:b3,a3:c2
> a1:a3,a2:b3,a3:c2
>
> a1:a1,a2:b1,a3:c3
> a1:a2,a2:b1,a3:c3
> a1:a3,a2:b1,a3:c3
>
> a1:a1,a2:b2,a3:c3
> a1:a2,a2:b2,a3:c3
> a1:a3,a2:b2,a3:c3
>
> a1:a1,a2:b3,a3:c3
> a1:a2,a2:b3,a3:c3
> a1:a3,a2:b3,a3:c3
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

I think you want to take a look at the itertools module
(http://docs.python.org/library/itertools.html), probably
itertools.product, although I can't see exactly what you want as a
final result.
The process will be something like:

turn a into list of lists of key:value pairs
call itertools.product() using star notation
(http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists)
to turn the list into sequential arguments
-- 
Rich "Roadie Rich" Lovely

Just because you CAN do something, doesn't necessarily mean you SHOULD.
In fact, more often than not, you probably SHOULDN'T.  Especially if I
suggested it.

10 re-discover BASIC
20 ???
30 PRINT "Profit"
40 GOTO 10
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list issue.. i think

2011-12-22 Thread Steven D'Aprano

bruce wrote:

hi.

got a test where i have multiple lists with key/values. trying to figure
out how to do a join/multiply, or whatever python calls it, where i have a


Whatever Python calls what? You need to explain what *you* mean by "a 
join/multiply" before we can tell what you are referring to.


Perhaps start with a simple example?



series of resulting lists/dicts that look like the following..

the number of lists/rows is dynamic..
the size of the list/rows will also be dynamic as well.

i've looked over the py docs, as well as different potential solns..

psuedo code, or pointers would be helpful.

thanks...

test data
a['a1']=['a1','a2','a3']
a['a2']=['b1','b2','b3']
a['a3']=['c1','c2','c3']



If you're indexing by key rather than by position, you need a dict, not a 
list. So:


a = {}
a['a1']=['a1','a2','a3']
a['a2']=['b1','b2','b3']
a['a3']=['c1','c2','c3']



end test result::
a1:a1,a2:b1,a3:c1
a1:a2,a2:b1,a3:c1
a1:a3,a2:b1,a3:c1


I don't even understand what that is supposed to mean.




--
Steven


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A few Python Mysteries [Reset]

2011-12-22 Thread Wayne Watson
Hi, I found it, but not in a place I would expect. It's under my 
username, Wayne. It is a folder and has three files:

breakpoints.lst
recent-files.lst
ZZrecent-files.lst

The last one has the odd ZZ, but is empty. breakpoints.lst is empty too.

recent-files.lst contains about 21 files like:
C:\Users\Wayne\Sandia_Meteors\Trajectory_Estimation\radiant.py
C:\Users\Wayne\Sandia_Meteors\Trajectory_Estimation\cross_prod.py

ZZ... is the most recent file, 7/18/2011.

If I right-click .idlerc, I can see properties for SYSTEM, some very 
oddly named user, Wayne, Admin, and WMPNetwork.




On 12/22/2011 2:34 PM, Alan Gauld wrote:

On 22/12/11 19:08, Wayne Watson wrote:


IOError: [Errno 13] Permission denied:
'C:\\Users\\Wayne\\.idlerc\\recent-files.lst'
-
Maybe as I pointed out a few msgs ago here the permissions shown on
Properties looked a bit odd.


But the problem here is with .idlerc in your home directory.

Can you find that file and ensure that read/write permissions
are set? It may be a hidden file so you might have to tweak
the View settings.

.idelrc is presumably where Idle stores your local config settings.
Although I confess I never noticed it when I used Windows. But then I 
probably never had a need to notice it!




--
   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

 CE 1955 October 20 07:53:32.6 UT
-- "The Date" The mystery unfolds.

Web Page:


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor