Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Emile van Sebille

On 7/5/2014 11:40 AM, Deb Wyatt wrote:


I'd be using a news reader if accessing
news was still free.


Try news.gmane.org.

Emile

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


Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread memilanuk

On 07/05/2014 11:53 AM, Mark Lawrence wrote:


As I said it's a known problem, but then so are the 4600 bugs at
bugs.python.org.  So why bother spending the time making the search
useful when there is a well known workaround


Because it's supposed to be the first place new (and old) users go to 
find their answers.


Because the work-around isn't published right *there* where people who 
aren't 'in the know' would expect to find it.


Because it looks kind of sketchy that the search function of the main 
documentation section of *the* primary web site for a programming 
language doesn't work right, and hasn't for some time even though its a 
'well-known' issue because it isn't considered a sexy enough problem to 
be addressed.


In my mind, that doesn't say very many *good* things about that language...

And before you say, 'Go for it, fix it yourself'... I'm one of those 
new-ish folks myself, and you probably don't want me tinkering around 
anywhere near the guts of any search engine ;)






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


Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Mark Lawrence

On 06/07/2014 19:08, memilanuk wrote:

On 07/05/2014 11:53 AM, Mark Lawrence wrote:


As I said it's a known problem, but then so are the 4600 bugs at
bugs.python.org.  So why bother spending the time making the search
useful when there is a well known workaround


Because it's supposed to be the first place new (and old) users go to
find their answers.



Not for me.  I'm on Windows and have a link on my desktop to the 
compiled help file for (currently) Python 3.4.1 that comes as part of 
the installation process.  I can find everything I need there in no time.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Danny Yoo
Let's summarize.  As it stands, this really is out of our direct
control, as Deb mentions.


The actions we can do seems to be:

  1.  To point folks to alternative search engines that are effective
in searching through Python documentation.

  2.  Direct feedback to the Python web site maintainers so that
either they fix the problem or are at least aware that something is
deficient.

  3.  Raise a call for volunteers.

  4.  Ignore.


I think all these actions have been proposed or approached in this thread.

* I think option #2 is ultimately the right long-term approach.  Given
that it's long term, I don't think the fix will come quickly, but as
long as the right people are notified about the problem, I trust it
will get fixed eventually.  I believe
https://www.python.org/dev/pydotorg/ should have links to the right
people.

* In my opinion, option #3 is probably more suited for a general
Python forum, rather than on Python-Tutor.  If we want to do that, I
think python-list or docs-sig are the right forums to do this:

https://mail.python.org/mailman/listinfo/python-list
https://mail.python.org/mailman/listinfo/docs

* Option #1 appears to work effectively on the example given in the
original post.  A search for the term [python max] reaches relevant
documentation on the major search engines.

* I will ignore option #4.

Other than those options, is there anything we're missing or anything
to add to the conversation?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A beginner having problems with inheritance

2014-07-06 Thread Danny Yoo
> My apologies to the tutors.
> I have identified my error, which was predictably elementary.
> With many thanks,


By the way, can you say what your conceptual error was or give an
example?  It might help the other folks here who are learning and who
may be making a similar mistake.  (And I'm curious!)  But if you don't
want to say, that's ok too.


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


Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Marc Tompkins
On Sun, Jul 6, 2014 at 1:57 PM, Danny Yoo  wrote:

>  2.  Direct feedback to the Python web site maintainers so that either
they fix the problem or are at least aware that something is deficient.

Google offers a per-site custom search; it's free for very basic
functionality and not very expensive for the whole enchilada.  (In any
case, Google has got enough value out of Python over the years that I bet
they'd provide it for free, if asked.)  I suppose there might be a bit of
DIY pride to be lost in using an out-of-the box solution, but...

>  4.  Ignore.
>  * I will ignore option #4.

I see what you did there.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Mark Lawrence

On 06/07/2014 21:57, Danny Yoo wrote:

Let's summarize.  As it stands, this really is out of our direct
control, as Deb mentions.

The actions we can do seems to be:

   2.  Direct feedback to the Python web site maintainers so that
either they fix the problem or are at least aware that something is
deficient.



This has been known about for years.  If my understanding is correct 
much of the web support is done on the same basis as (c)Python support, 
i.e. volunteers.  Given that the completely updated site only went live 
within the past few months, I believe that fixing the search was not 
very high up the priority list, possibly not even on it :(


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


[Tutor] Resuming one block of code continuously after exception in try/except construction

2014-07-06 Thread Ali Mammadov
Hello fellow coders!
Today I encountered a small difficulty while working with files.As a common
pratice, I want my function to check user's input(in this case it's file
name) and re-ask it again and again(until correct) offering him two
choices: re-enter file name or close program.I've decided to use try/except
construction in this particular task. After a bit of googling, I still
didn't figure out how and if it's possible to re-run code in try part again
if exception raises. Should I use try/except or you would recommend me
another way(god bless, we have plenty of them! :))? What are the pros&cons
of this method?

BTW, I created a small gist located here
 which demonstrates my
problem.

Thank you in advance for your help!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Resuming one block of code continuously after exception in try/except construction

2014-07-06 Thread Alan Gauld

On 06/07/14 22:00, Ali Mammadov wrote:


common pratice, I want my function to check user's input(in this case
it's file name) and re-ask it again and again(until correct) offering
him two choices: re-enter file name or close program.I've decided to use
try/except construction in this particular task.


Thats the wrong solution.
try/except is for catching errors not repeating actions.
You need to combine the try/except with a loop.


BTW, I created a small gist located here
 which demonstrates my
problem.


For short (<100lines) example just post it in your message, it saves a 
lot of extra jumping around. Here it is:


---
def makelgpwdcombs(brutelistname):
try:
blst = open(brutelistname, 'r')
except:
print("[-] Invalid file name or insufficient priviliges")
else:
print("[+] File opened. Working...")


Drop the else clause and put the try/except inside a while...

def makelgpwdcombs(brutelistname):
while True:
   try:
  blst = open(brutelistname, 'r')
  break # exit loop if no error
   except:
  print("[-] Invalid file name or insufficient priviliges")

print("[+] File opened. Working...")   # only after valid input

loops are for repeating, try/except is for catching errors.
Use the right tool for the job.

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

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


Re: [Tutor] Resuming one block of code continuously after exception in try/except construction

2014-07-06 Thread Alan Gauld

On 07/07/14 00:28, Alan Gauld wrote:


Drop the else clause and put the try/except inside a while...

def makelgpwdcombs(brutelistname):
 while True:
   try:
blst = open(brutelistname, 'r')
   break # exit loop if no error


oops, indentation error there. Sorry
  while True:
  try:
 blst = open(brutelistname, 'r')
 break # exit loop if no error


except:
   print("[-] Invalid file name or insufficient priviliges")

 print("[+] File opened. Working...")   # only after valid input



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

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


Re: [Tutor] Resuming one block of code continuously after exception in try/except construction

2014-07-06 Thread Alan Gauld

On 06/07/14 22:00, Ali Mammadov wrote:


BTW, I created a small gist located here
 which demonstrates my
problem.


I forgot one other thing...

-
def makelgpwdcombs(brutelistname):
try:
blst = open(brutelistname, 'r')
except:
print("[-] Invalid file name or insufficient priviliges")--


Don't use a bare except here./ catch the specific errror(s) you expect 
to get. In this case its probably IOError...


Then any unexpected errors will generate a stacktrace and not a 
confusing (and wrong) error message




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

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


Re: [Tutor] Resuming one block of code continuously after exception in try/except construction

2014-07-06 Thread Steven D'Aprano
On Sun, Jul 06, 2014 at 11:00:38PM +0200, Ali Mammadov wrote:
> Hello fellow coders!
> Today I encountered a small difficulty while working with files.As a common
> pratice, I want my function to check user's input(in this case it's file
> name) and re-ask it again and again(until correct) offering him two
> choices: re-enter file name or close program.I've decided to use try/except
> construction in this particular task. After a bit of googling, I still
> didn't figure out how and if it's possible to re-run code in try part again
> if exception raises.

That's kind of tricky, because you have two different exceptional 
circumstances, and you want to do something different in each case. 
The best way, I think, is two separate the two parts into two 
functions:


import sys

def get_filename(extra_prompt):
if extra_prompt:
print(extra_prompt)
print("Enter a file name, or type Ctrl-D to exit the program.")
# On Windows, I think you need Ctrl-Z [enter] instead of Ctrl-D.
try:
return input("File name: ")  # Use raw_input in Python 2.
except EOFError:
sys.exit()


def get_file():
f = None
prompt = ""
while f is None:
name = get_filename(prompt)
try:
f = open(name, "r")
# Python 3 exceptions. For Python 2, see below.
except FileNotFoundError:
prompt = "File not found; please try again."
except IsADirectoryError:
prompt = "That is a directory; please try again."
except PermissionError:
prompt = ("You do not have permission to open that"
  + " file. Please try again.")
# This must come last.
except IOError as err:
prompt = "%s : please try again." % err
return f


with get_file() as f:
for line in f:
 print(line)




In Python 2, we don't have all the different sorts of exceptions. 
Instead, you have to catch IOError only, and then inspect the errno 
attribute of the exception to find out what it is:

try:
f = open(name, "r")
except IOError as err:
if err.errno == 2:
prompt = "File not found; please try again."
elif err.errno == 21:
prompt = "That is a directory; please try again."
elif err.errno == 13:
prompt = ("You do not have permission to open that"
  + " file. Please try again.")


Unfortunately, the error codes can be different on different operating 
systems. To write platform-independent code, you should import the errno 
module and check the error code by name:

   if err.errno == errno.ENOENT:

etc.



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


Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Cameron Simpson

Not a fix, but I for one always start at the index:

  https://docs.python.org/3/genindex.html

(or the python 2 version) for ad hoc stuff.

For speed and convenience I always have a fairly current copy of the docs on my 
desktop, making browsing them near instant.

--

Each new user of a new system uncovers a new class of bugs. - Kernighan
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Socket Error: Connection refused

2014-07-06 Thread Pamela Wightley
Hi,

I need some help, I  have no programming skills and am trying to teach myself 
python. I keep on getting an error message as follows:

Socket Error: Connection refused,

and the following error as well


[cid:image001.png@01CF99F5.90253AF0]


Any assistance is appreciated.

Pamela Wightley
[MorgijAnalytics e-sig][MorgijAnalytics e-apple]
Level 3 | 10 Bond Street |  Sydney | NSW 2000 | Australia
[P] (02) 8197 1828 |  [M] 0400 892 714  |
pamela.wight...@morgij.com.au  |  
www.morgij.com.au |   
www.marqservices.com

The contents of this email and any attachments are strictly confidential and 
intended solely for the attention and use of the named addressee(s). If you are 
not the intended recipient you are not authorised to and must not disclose, 
copy, distribute, or retain this message without our authority. This email and 
all of its contents are subject to copyright. If you have received this email 
in error, please notify the sender by a return e-mail immediately. Please note 
that we do not accept responsibility for viruses and you should therefore scan 
any attachments.

[E-sig Green Message]


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


Re: [Tutor] Python Socket Error: Connection refused

2014-07-06 Thread Danny Yoo
> I need some help, I  have no programming skills and am trying to teach myself 
> python. I keep on getting an error message as follows:

[content cut]

It appears from the screenshot that you are running some version of
Windows that has software that's interfering with IDLE.  As the error
message says,

"IDLE's subprocess didn't make connection.  Either IDLE can't start a
subprocess or personal firewall software is blocking the connection."

I would believe the error message.  The IDLE program is trying to
create a network connection, but fails to do so.

Windows machines typically have a restrictive firewall that limit
certain operations.  Do you know if you have a firewall running on
your computer?  Note that there are other kinds of software that will
interfere, such as proxy network software.  See:
http://bugs.python.org/issue14576 for an example of such interference
by an external piece of software.


Software installation is stupid-hard.  If you are just starting off,
you might be able to use one of the "online" Python-based
environments, at least as a temporary workaround until you can resolve
your installation issue.  See:

http://repl.it/languages/Python

It's not a perfect solution, but at least you may be able to start
doing simple experiments with Python without having to fight with
installation.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor