[issue25758] ensurepip/venv broken on Windows if path includes unicode

2015-11-28 Thread Laura Creighton

Changes by Laura Creighton :


--
nosy: +Marcus.Smith, dstufft, ncoghlan, paul.moore

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25741] Usual Installation Directory

2015-11-28 Thread Eryk Sun

Eryk Sun added the comment:

> LOCALAPPDATA is set by the operating system, typically to 
> C:\Users\\AppData\Local (at least since Vista I
> think? Certainly since Win7

Vista introduced LOCALAPPDATA, so there's no problem referencing it in the docs 
for 3.5+. 

On a related note, section 3.4.4.1 [1] could be changed to use %LOCALAPPDATA% 
instead of referring to the shell function SHGetFolderPath and 
CSIDL_LOCAL_APPDATA. 

[1]: https://docs.python.org/3.5/using/windows.html#customization-via-ini-files

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9504] signal.signal/signal.alarm not working as expected

2015-11-28 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Victor: read(2) and recv(2) are defined as returning all available data when 
interrupted by a signal and might therefore not return an error. The same is 
true for write(2): it returns the number of bytes written when there are any 
bytes written (instead of setting errno to SIGINT and returning an error).

I'd expect the C implementation of readall to behave the same as the Python 
implementation: a signal handler that raises an exception can cause data loss 
due to discarding the buffer that's used to collect the data.  The data loss in 
the script isn't worse than it currently is, AFAIK it would currently lose data 
due to raising the exception just after the call to readall in the next loop 
through the eval loop.

If I read the issue correctly the signal handling issue mentioned here is 
basically similar to the one in this scriptlet:

# BEGIN
import signal, sys
import subprocess

def handler(sig, frames):
raise RuntimeError("Alarm!")

signal.signal(signal.SIGALRM, handler)
signal.alarm(5)
b = sys.stdin.buffer.raw.readall()
print(len(b))
signal.alarm(0)
#END

When you run this with a large file on stdin (I've used /dev/zero) the script 
will continue to run indefinitely and cannot be cleanly interrupted at all (on 
my system its eventually killed by the system due to running out of its rlimit 
limitations, otherwise it can only be killed by sending it an uncatchable 
signal like SIGKILL or SIGABRT).

--
nosy: +ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: python response slow when running external DLL

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 11:13:38 +0100, Peter Otten writes:
>jf...@ms4.hinet.net wrote:
>> Using thread is obviously more logical. I think my mistake was the "while
>> busy:  pass" loop which makes no sense because it blocks the main thread,
>> just as the time.sleep() does. That's why in your link (and Laura's too)
>> the widget.after() scheduling was used for this purpose.

I never saw the reply that Peter is replying to.
The threading module constructs a higher level interface on top of the
low level thread module.  Thus it is the preferred way to go for
standard Python code -- and even Fredrik's recipe contains the
line:
import thread # should use the threading module instead!

Laura

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


[issue25751] ctypes.util , Shell Injection in find_library()

2015-11-28 Thread Bernd Dietzel

Bernd Dietzel added the comment:

i made the ubuntu link readable for everyone.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: ncoghlan -> rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25757] Subclasses of property lose docstring

2015-11-28 Thread Torsten Landschoff

Torsten Landschoff added the comment:

Prompted by Emanuel's comment I ran the test with repetitions. This does not 
actually test his assertion that I missed a decref since he referred to the 
error case when setting the __doc__ key of the instance dict fails. But I was 
curious none the less.

I was shocked that this failed with

```
torsten@defiant:~/mirror/cpython$ make test TESTOPTS="-R 3:2 test_property"
...
test test_property failed -- Traceback (most recent call last):
  File "/home/torsten/mirror/cpython/Lib/test/test_property.py", line 172, in 
test_property_decorator_doc_writable
self.assertEqual(sub.__class__.spam.__doc__, 'Eggs')
AssertionError: 'Spam' != 'Eggs'
```

But this was not introduced by my changes, rather it is an existing bug in the 
tests: test_property_decorator_doc_writable modifies a class created on module 
level so the second repetition sees the already updated class.

fix_repetitions.diff contains a fix for this problem (by defining the class 
locally in the test method).

While at it I introduced a refleak on purpose and this is correctly reported by 
the tests. Good to know how to test for this :-)

--
Added file: http://bugs.python.org/file41183/fix_repetitions.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



askopenfilename() (was: Re: non-blocking getkey?)

2015-11-28 Thread Ulli Horlacher
Ulli Horlacher  wrote:
> eryksun  wrote:
> > On Thu, Nov 19, 2015 at 10:31 AM, Michael Torrie  wrote:
> > > One windows it might be possible to use the win32 api to enumerate the
> > > windows, find your console window and switch to it.
> > 
> > You can call GetConsoleWindow [1] and then SetForegroundWindow [2].
> (...)
> 
> great, this works! Thanks!

One of my Windows test users reports, that the file dialog window of
askopenfilename() starts behind the console window and has no focus.
On Linux (XFCE) I do not have this problem.

I start it with:

  Tk().withdraw()
  file = askopenfilename(title='select a file',initialdir=HOME)
  set_window_focus() # give focus back to console window

Can one force askopenfilename() to start in foreground with focus?

-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The docs are correct but are apparently misleading ("rich comparison methods" 
means all six comparison methods while "rich comparison ordering methods" means 
only the four that provide order).  That said, I think it would be perfectly 
reasonable to amend the code to supply __ne__ if it is missing.  That would be 
reduce the likelihood of bugs arising when supplied only __eq__ and one of the 
four ordering methods but not __ne__.

--
assignee:  -> ncoghlan
keywords: +patch
Added file: http://bugs.python.org/file41180/total_ordering_ne.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Now defined __ne__ always silently overridden.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25741] Usual Installation Directory

2015-11-28 Thread Firat Ozgul

Firat Ozgul added the comment:

Maybe that part of the tutorial should also include a link to 
https://docs.python.org/3/using/windows.html. This document contains all the 
details for using Python on Windows.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Looking for ideas to improve library API

2015-11-28 Thread Devin Jeanpierre
Documentation is all you can do.

-- Devin

On Thu, Nov 26, 2015 at 5:35 AM, Chris Lalancette  wrote:
> On Thu, Nov 26, 2015 at 7:46 AM, Devin Jeanpierre
>  wrote:
>> Why not take ownership of the file object, instead of requiring users
>> to manage lifetimes?
>
> Yeah, I've kind of been coming to this conclusion.  So my question
> then becomes: how do I "take ownership" of it?  I already keep a
> reference to it, but how would I signal to the API user that they
> should no longer use that file object (other than documentation)?
>
> Thanks,
> Chris
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25757] Subclasses of property lose docstring

2015-11-28 Thread Emanuel Barry

Emanuel Barry added the comment:

Looking at it again, it appears you didn't have to decref it; my bad.

Both patches LGTM.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Implementing only .__get/setstate__() doesn't fix all problem. We have 
implement also __getnewargs_ex__(). But implemented __getnewargs_ex__() has 
priority over __getnewargs__() implemented in subclasses.

And may be there are problems with other optional special methods that are 
incorrectly delegated to the stream in codecs IO classes.

I think more reliable way is to disallow delegating all special (or may be even 
private) methods. Here is a patch.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
stage:  -> patch review
type: enhancement -> behavior
versions: +Python 3.5, Python 3.6 -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-11-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +patch
Added file: http://bugs.python.org/file41184/codecs_stream_delegating.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: python response slow when running external DLL

2015-11-28 Thread Peter Otten
jf...@ms4.hinet.net wrote:

> Peter Otten at 2015/11/27 UTC+8 8:20:54PM wrote:
> 
>> Quick-fix example:
>> def download():
>> var.set("Starting download...")
>> root.update_idletasks()
>> time.sleep(3)
>> var.set("... done")
> 
> Thanks, Peter, The update_idletasks() works. In my trivial program it's
> easy to apply for there are only two places call the DLL function.
> 
>> A cleaner solution can indeed involve threads; you might adapt the
>> approach from  (Python 2
>> code).
> 
> Using thread is obviously more logical. I think my mistake was the "while
> busy:  pass" loop which makes no sense because it blocks the main thread,
> just as the time.sleep() does. That's why in your link (and Laura's too)
> the widget.after() scheduling was used for this purpose.

No, the point of both recipes is that tkinter operations are only ever 
invoked from the main thread. The main thread has polling code that 
repeatedly looks if there are results from the helper thread. As far I 
understand the polling method has the structure

f():
   # did we get something back from the other thread?
   # a queue is used to avoid race conditions

   # if yes react.
   # var_status.set() goes here

   # reschedule f to run again in a few millisecs; 
   # that's what after() does
 
> From what I had learned here, the other way I can do is making the codes
> modified as follows. It will get ride of the "result" and "busy" global
> variables, but it also makes the codes looks a little ugly. I think I will
> take the update_idletasks() way in this porting for it seems more simpler,
> and can be used on thread or non-thread calling. Thank you again.
> .
> .
> #do the rest
> var_status.set('Download...')
> _thread.start_new_thread(td_download, ())  #must use threading
> 
> def td_download():
> result = mydll.SayHello()
> if result:
> var_status.set("Download Fail at %s" % hex(result))
> showerror('Romter', 'Download Fail')
> else:
> var_status.set('Download OK')
> showinfo('Romter', 'Download OK')

As td_download() runs in the other thread the var_status.set() methods are 
problematic.

Another complication that inevitably comes with concurrency: what if the 
user triggers another download while one download is already running? If you 
don't keep track of all downloads the message will already switch to 
"Download OK" while one download is still running.

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


[issue18068] pickle + weakref.proxy(self)

2015-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The weakref.proxy object delegates all attribute access to referred object, 
including special attributes used in pickling, like __class__ or __getstate__.

test.recursive is not test, but it looks as TestPickle instance for the 
pickler. It is pickled and unpickled as TestPickle instance.

>>> test.recursive.__class__

>>> test.recursive.__getstate__
>
>>> test.recursive.__reduce_ex__(2)
__getstate__ 3071478700
(, (,), 
{'recursive': }, None, 
None)
>>> pickle.loads(pickle.dumps(test.recursive, 2))
__getstate__ 3071478700
__setstate__ 3071525356
<__main__.TestPickle object at 0xb713c1ec>

Since test.recursive.recursive is test.recursive, this recursion is detected by 
pickler.

This issue is similar to issue6395, but since weakref.proxy is not 
subclassable, we can just implement correct __reduce__.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25757] Subclasses of property lose docstring

2015-11-28 Thread Torsten Landschoff

Changes by Torsten Landschoff :


Added file: http://bugs.python.org/file41181/subprop_doc_r2.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25758] ensurepip/venv broken on Windows if path includes unicode

2015-11-28 Thread Dima Tisnek

New submission from Dima Tisnek:

One of my students installed Python 3.5 on Windows 10 to default location where 
user name "Łukasz" contains unicode.

Now "-m venv" and "-m ensurepip" do not work:

C:\Users\Łukasz>C:\Users\Łukasz\AppData\Local\Programs\Python\Python35-32\python.exe
 -m venv workshops
Error: Command '['C:\\Users\\\u0141ukasz\\workshops\\Scripts\\python.exe', 
'-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit 
status 1

C:\Users\Łukasz>C:\Users\Łukasz\AppData\Local\Programs\Python\Python35-32\python.exe
 -m ensurepip
Traceback (most recent call last):
  File 
"C:\Users\\u0141ukasz\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", 
line 170, in _run_module_as_main
"__main__", mod_spec)
  File 
"C:\Users\\u0141ukasz\AppData\Local\Programs\Python\Python35-32\lib\runpy.py", 
line 85, in _run_code
exec(code, run_globals)
  File 
"C:\Users\\u0141ukasz\AppData\Local\Programs\Python\Python35-32\lib\ensurepip\__main__.py",
 line 4, in 
ensurepip._main()
  File 
"C:\Users\\u0141ukasz\AppData\Local\Programs\Python\Python35-32\lib\ensurepip\__init__.py",
 line 209, in _main
default_pip=args.default_pip,
  File 
"C:\Users\\u0141ukasz\AppData\Local\Programs\Python\Python35-32\lib\ensurepip\__init__.py",
 line 116, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File 
"C:\Users\\u0141ukasz\AppData\Local\Programs\Python\Python35-32\lib\ensurepip\__init__.py",
 line 40, in _run_pip
import pip
  File "", line 969, in _find_and_load
  File "", line 954, in _find_and_load_unlocked
  File "", line 896, in _find_spec
  File "", line 1136, in find_spec
  File "", line 1112, in _get_spec
  File "", line 1093, in _legacy_get_spec
  File "", line 444, in spec_from_loader
  File "", line 530, in 
spec_from_file_location
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: 
invalid character

--
components: Unicode
messages: 255534
nosy: Dima.Tisnek, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: ensurepip/venv broken on Windows if path includes unicode
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25758] ensurepip/venv broken on Windows if path includes unicode

2015-11-28 Thread SilentGhost

Changes by SilentGhost :


--
components: +Windows
nosy: +brett.cannon, eric.snow, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: askopenfilename()

2015-11-28 Thread Christian Gollwitzer

Am 28.11.15 um 11:29 schrieb Ulli Horlacher:

One of my Windows test users reports, that the file dialog window of
askopenfilename() starts behind the console window and has no focus.
On Linux (XFCE) I do not have this problem.

I start it with:

   Tk().withdraw()
   file = askopenfilename(title='select a file',initialdir=HOME)
   set_window_focus() # give focus back to console window

Can one force askopenfilename() to start in foreground with focus?


I can't test it right now, but I think it /should/ go into the 
foreground by itself. For a toplevel window, which you create manually, 
there is a lift() method which asks the OS to move the window to the 
top. But on Windows, this file dialog is a native call and cannot be 
influenced that much.


I see two thingd:

1) Tk().withdraw()

- this seems odd to me, because you don't keep a reference to the Tk 
object around. Better do


root=Tk()
roo.withdraw()

2) Maybe it helps if you inject an update() after the withdraw(), maybe not

root.update()

3) I can confirm, that also on OSX the file dialog does not raise above 
the console window, though it is not as bad because the dialog window is 
muhc bigger then the console window.


I think that you are curing a lot of symptoms with the focus setting to 
the console etc. Many problems would simply go away if you wrote the 
whole thing as a GUI program. If I understand correctly, what you want - 
a program to select files and folders to upload to your server - then 
this would not be that much more work than the CLI with input() which 
you are writing, and definitely less work to get it correct than the 
plastering of the symptoms.


For example, a very simple approach would use a listbox with a + and a - 
button. upon hitting - (or the delete key), you delete the selected 
entries. Upon hitting +, you pop up the file selection dialog. upon 
hitting a Go button, you send the files to the server. A minimalistic 
version of it is included below. That is less then 50 lines of code, 
including comments, without all the focus problems, providing a standard 
desktop GUI metaphor. I haven't seen your command line code, but I doubt 
that it is significantly simpler.


Of course, the code below can still use a great deal of polishing, like 
scrollbars for the listbox, allowing multiple selection both for the 
file dialog and the listbox, nice icons for the buttons, trapping the 
close button on the main window with an "are you sure?"-type question, 
maybe wrapping it up in a class, a progress bar during the upload and a 
way to interrupt it... which is left as an exercise to the reader.


Christian

=
import Tkinter as tk, tkFileDialog as fd, ttk
from Tkinter import N,S,W,E
# create one ttk::frame to fill the main window
root=tk.Tk()
main=ttk.Frame(master=root)
# tell the pack geometry manager to completely
# fill the toplevel with this frame
main.pack(fill=tk.BOTH, expand=1)

# now create a listbox and a button frame
lb=tk.Listbox(master=main)
bf=ttk.Frame(master=main)

# use the grid manager to stack them, whereby
# the listbox should expand
lb.grid(row=0, column=0, sticky=(N,S,E,W))
bf.grid(row=1, column=0, sticky=(N,S,E,W))
main.rowconfigure(0, weight=1)
main.columnconfigure(0, weight=1)

def addfile():
filename=fd.askopenfilename()
if filename:
lb.insert(tk.END, filename)

def remove(*args):
sel=lb.curselection()
if sel:
lb.delete(sel)

def submit():
print("Submitting files:")
for filename in lb.get(0,tk.END):
print("Sending %s"%filename)

# create the three buttons
btnplus=ttk.Button(master=bf, text="+", command=addfile)
btnminus=ttk.Button(master=bf, text="-", command=remove)
btngo=ttk.Button(master=bf, text="Submit", command=submit)

btnplus.pack(side=tk.LEFT)
btnminus.pack(side=tk.LEFT)
btngo.pack(side=tk.LEFT)

# bind also the delete and Backspace keys
lb.bind('', remove)
lb.bind('', remove)

root.mainloop()
===



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


Re: Python 3 virtualenvs

2015-11-28 Thread Jon Ribbens
On 2015-11-28, D.M. Procida  
wrote:
> I have a new installation of Debian Jessie, with Python 2.7 and 3.4
> installed.
>
> I want to use Python 3.4 by default for most things, so I want
> virtualenv to create Python 3.4 virtualenvs unless I ask it to
> otherwise.
>
> It turns out that this seems to be inordinately complex.

sudo apt-get remove python-virtualenv
sudo apt-get install python3-virtualenv
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: askopenfilename()

2015-11-28 Thread Christian Gollwitzer

Am 28.11.15 um 13:48 schrieb Ulli Horlacher:

Christian Gollwitzer  wrote:

Many problems would simply go away if you wrote the whole thing as a GUI
program.


Too much hassle.
The predecessor was a Perl/Tk program and I have had to invest 90% of the
programming work into the GUI handling. No fun at all.


As I see it, the program consists only of user interface - or is there 
any "algorithm" working behinds the scenes? Maybe you could pass the 
task on to somebody who enjoys GUI programming?



Now, with fexit in Python, I skipped most of these problems.
The only GUI part is the file selection.



If I understand correctly, what you want - a program to select files and
folders to upload to your server


This is only one of the tasks. The main menu looks:

[s]  send a file or directory
[g]  get a file
[c]  change login data (user, server, auth-ID)
[l]  login with webbrowser
[u]  update fexit
[h]  help
[q]  quit


All of this is easily integrated into a GUI like the one I posted (have 
you tried it?), either as a button or as a menu entry. IMO the most 
common GUI pattern for this kind of thing is a side-by-side view of the 
directories on the server and on the client, and a button (or 
drag'n'drop) to move files between both views. I understand this is not 
as easy as the script posted by me - nonetheless quite doable. For an 
experienced GUI script writer it'll take a weekend to get the basics 
running.



(with more features to come in the future)

And the CLI:

framstag@juhu:~: ./fexit.py -h
usage: fexit [-C "comment"] [-a container] file(s) recipient[,...]
example: fexit flupp.avi frams...@rus.uni-stuttgart.de
example: fexit -C "more data" -a labdata *.png x...@flupp.org,x...@flupp.org

usage: fexit FEX-download-URL
example: fexit http://fex.rus.uni-stuttgart.de/fop/jHn34yp7/flupp.avi



This part should probably stay as it is. For a command line tool, an 
scp-like interface seems well-fitting. But for guided user input, an 
interface which prompts the user for input has never been a good 
solution. You have to work very hard to make that convenient. Have a 
look at lftp, for instance. In the end, real GUI programming will be 
easier (and more accessible)


A (still) alternative solution would be an interface to the OS to make 
it a remote mounted folder (works for WebDAV on any modern OS, for 
instance) or a daemon, which watches and synchronizes a directory (this 
is how Dropbox works). This way it feels much more integrated to the 
user - they can use whatever file manager they like to do the transfer, 
or even "save" from any application (like Word, Firefox, ...) into the 
remote folder.


Christian

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


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This doesn't work with new-style classes that always have __ne__ inherited from 
object.

I afraid that the only way to fix this issue is to backport Python 3 behavior 
of default __ne__, automatically fallback to __eq__.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Christian Gollwitzer  wrote:

> Am 28.11.15 um 11:29 schrieb Ulli Horlacher:
> > One of my Windows test users reports, that the file dialog window of
> > askopenfilename() starts behind the console window and has no focus.
> > On Linux (XFCE) I do not have this problem.
> >
> > I start it with:
> >
> >Tk().withdraw()
> >file = askopenfilename(title='select a file',initialdir=HOME)
> >set_window_focus() # give focus back to console window
> >
> > Can one force askopenfilename() to start in foreground with focus?
> 
> I can't test it right now, but I think it /should/ go into the 
> foreground by itself. 

This is what I think, too :-)
But my test user reports me, it is not so.


> I see two thingd:
> 
> 1) Tk().withdraw()
> 
> - this seems odd to me, because you don't keep a reference to the Tk 
> object around. 

I thought, I need it for Tk initialization.
But true, it is superfluous


> I think that you are curing a lot of symptoms with the focus setting to 
> the console etc.

This is done after the file selection window is closed. This works.


> Many problems would simply go away if you wrote the whole thing as a GUI
> program.

Too much hassle.
The predecessor was a Perl/Tk program and I have had to invest 90% of the 
programming work into the GUI handling. No fun at all.
Now, with fexit in Python, I skipped most of these problems.
The only GUI part is the file selection.


> If I understand correctly, what you want - a program to select files and
> folders to upload to your server 

This is only one of the tasks. The main menu looks:

[s]  send a file or directory
[g]  get a file
[c]  change login data (user, server, auth-ID)
[l]  login with webbrowser
[u]  update fexit
[h]  help
[q]  quit

(with more features to come in the future)

And the CLI:

framstag@juhu:~: ./fexit.py -h
usage: fexit [-C "comment"] [-a container] file(s) recipient[,...]
example: fexit flupp.avi frams...@rus.uni-stuttgart.de
example: fexit -C "more data" -a labdata *.png x...@flupp.org,x...@flupp.org

usage: fexit FEX-download-URL
example: fexit http://fex.rus.uni-stuttgart.de/fop/jHn34yp7/flupp.avi


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: rhettinger -> ncoghlan
Added file: http://bugs.python.org/file41182/total_ordering_ne2.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25758] ensurepip/venv broken on Windows if path includes unicode

2015-11-28 Thread Eryk Sun

Eryk Sun added the comment:

The problem is that the compile_source function in Modules/zipimport.c calls 
PyUnicode_EncodeFSDefault to get an encoded string to pass as the filename 
argument of Py_CompileString. On Windows this uses the ANSI codepage (i.e. 
'mbcs'). Apparently your system's ANSI codepage doesn't map the "Ł" character. 

I reproduced the problem more simply by copying pip-7.1.2-py2.py3-none-any.whl 
to a subdirectory named "Łukasz"; adding the wheel path to sys.path; and 
attempting to execute "import pip". 

One solution is to replace Py_CompileString with Py_CompileStringObject. This 
way compile_source doesn't have to worry about encoding its pathname argument. 
A minimal patch is attached, but it needs a test.

--
keywords: +patch
nosy: +eryksun
versions: +Python 3.6
Added file: http://bugs.python.org/file41185/issue25758_1.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Ulli Horlacher  wrote:

> One of my Windows test users reports, that the file dialog window of
> askopenfilename() starts behind the console window and has no focus.

I have got a followup: this happens only with Windows XP, not with Windows
7. Therefore I will ignore this problem :-)


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find relative url in mixed text/html

2015-11-28 Thread Rob Hills
Hi Paul,

On 28/11/15 13:11, Paul Rubin wrote:
> Rob Hills  writes:
>> Note, in the beginning of this project, I looked at using "Beautiful
>> Soup" but my reading and limited testing lead me to believe that it is
>> designed for well-formed HTML/XML and therefore was unsuitable for the
>> text/html soup I have.  If that belief is incorrect, I'd be grateful for
>> general tips about using Beautiful Soup in this scenario...
> Beautiful Soup can deal with badly formed HTML pretty well, or at least
> it could in earlier versions.  It gives you several different parsing
> options to choose from now.  I think the default is lxml which is fast
> but maybe more strict.  Check what the others are and see if a loose
> slow one is still there.  It really is pretty slow so plan on a big
> computation task if you're converting a large forum.

I've had another look at Beautiful Soup and while it doesn't really help
me much with urls (relative or absolute) embedded within text, it seems
to do a good job of separating out links from the rest, so that could be
useful in itself.

WRT time, I'm converting about 65MB of data which currently takes 14
seconds (on a 3yo laptop with a SSD running Ubuntu), which I reckon is
pretty amazing performance for Python3, especially given my relatively
crude coding skills.  It'll be interesting to see if using Beautiful
Soup adds significantly to that.

> phpBB gets a bad rap that's maybe well-deserved but I don't know what to
> suggest instead.

I did start to investigate Python-based alternatives; I've not heard
much good said about php, but I probably move in the wrong circles. 
However, our hosting service doesn't support Python so I stopped
hunting.  Plus there is a significant group of forum members who hold
very strong opinions about the functionality they want and it took a lot
of work to get them to agree on something!

All that said, I'd be interested to see specific (and hopefully
unbiased) info about phpBB's failings...

Cheers,

-- 
Rob Hills
Waikiki, Western Australia

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


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, sorry. Then the patch LGTM.

--
stage: needs patch -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Find relative url in mixed text/html

2015-11-28 Thread Rob Hills
Hi Laura,

On 29/11/15 01:04, Laura Creighton wrote:
> In a message of Sun, 29 Nov 2015 00:25:07 +0800, Rob Hills writes:
>> All that said, I'd be interested to see specific (and hopefully
>> unbiased) info about phpBB's failings...
> People I know of who run different bb software say that the spammers
> really prefer phpBB.  So keeping it spam free is about 4 times the
> work as for, for instance, IPB.
>
> Hackers seem to like it too -- possibly due to this:
> http://defensivedepth.com/2009/03/03/anatomy-of-a-hack-the-phpbbcom-attack/
>
> make sure you aren't vulnerable.

Thanks for the link and the advice.

Personally, I'd rather go with something based on a language I am
reasonably familiar with (eg Python or Java) however it seems the vast
bulk of Forum software is based on PHP :-(

Cheers,

-- 
Rob Hills
Waikiki, Western Australia

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


[issue25735] math.factorial doc should mention integer return type

2015-11-28 Thread Mark Dickinson

Mark Dickinson added the comment:

[Terry]

>>> factorial(decimal.Decimal(5.2))
120

Yep, that's definitely wrong. If we want to behave the same way as for float, 
we should accept only integral Decimal values. (Though I'm not much of a fan of 
the float behaviour: I would have preferred math.factorial not to accept floats 
at all.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



An Educational Software Platform written in Python

2015-11-28 Thread Cai Gengyang
So after reading YCombinator's new RFS, I have decided I want to build an 
educational software platform written in Python (mostly, if not entirely).


Here is the description from YCombinator's RFS :

If we can fix education, we can eventually do everything else on this list.
The first attempts to use technology to fix education have focused on using the 
Internet to distribute traditional content to a wider audience. This is good, 
but the Internet is a fundamentally different medium and capable of much more.

Solutions that combine the mass scale of technology with one-on-one in-person 
interaction are particularly interesting to us.

This may not require a "breakthrough" technology in the classical sense, but at 
a minimum it will require very new ways of doing things.


What resources would I need to obtain, learn and utilise on order to create 
this platform? Can I create something like this entirely in Python, or would I 
need to learn other technologies? Anyone can give some directions, thanks alot !


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


[issue25634] Add a dedicated subclass for attribute missing errors

2015-11-28 Thread Ethan Furman

Ethan Furman added the comment:

Note for posterity:  the current behavior of __getattr__ is what allows Enum to 
work correctly.

--
nosy: +ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20836] Pickle Nonetype

2015-11-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

In Python 2.7, __ne__ isn't inherited from object.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: An Educational Software Platform written in Python

2015-11-28 Thread Marko Rauhamaa
Cai Gengyang :

> Can I create something like this entirely in Python,

Absolutely. It will only take ten to one hundred years for one person to
create.


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


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: ncoghlan -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25485] Add a context manager to telnetlib.Telnet

2015-11-28 Thread R. David Murray

R. David Murray added the comment:

Thanks, Stéphane.  I adjusted the docs...we don't seem to be very consistent 
about how we document addition of content manager support, so I picked what I 
liked best.  Also, FYI it is generally best (at this point in time) to not 
include the NEWS item, but enhancements should inlcude a what's new entry (I 
added one).

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Christian Gollwitzer  wrote:

> Am 28.11.15 um 13:48 schrieb Ulli Horlacher:
> > Christian Gollwitzer  wrote:
> >> Many problems would simply go away if you wrote the whole thing as a GUI
> >> program.
> >
> > Too much hassle.
> > The predecessor was a Perl/Tk program and I have had to invest 90% of the
> > programming work into the GUI handling. No fun at all.
> 
> As I see it, the program consists only of user interface - or is there 
> any "algorithm" working behinds the scenes?

There is a lot of "algorithms", about 50 kB of code:
- resuming upload and download after link failures
- sending multiple files as zip or tar containers
- deleting files
- configuring login
- handling HTTP proxy
- many other things...


> Maybe you could pass the task on to somebody who enjoys GUI programming?

No, I then have to maintain it. I do not like to support foreign code. I
was in this situation already. The client was written in Java, which I do
not know. I have had to throw it away some day, because I was not able to
fix the bugs.

Therefore I started to write the new client fexit in Python.
Here we are :-)


> > This is only one of the tasks. The main menu looks:
> >
> > [s]  send a file or directory
> > [g]  get a file
> > [c]  change login data (user, server, auth-ID)
> > [l]  login with webbrowser
> > [u]  update fexit
> > [h]  help
> > [q]  quit
> 
> All of this is easily integrated into a GUI like the one I posted (have 
> you tried it?)

As I wrote: I have done this already with Perl/Tk and it was HASSLE.
No fun at all.


> IMO the most common GUI pattern for this kind of thing is a side-by-side
> view of the directories on the server and on the client

There is no directory view on server side.


> For an experienced GUI script writer it'll take a weekend to get the
> basics running.

I am not even a beginner GUI script writer and I do not want to become one.
GUIs are most superfluous and delay the work flow.


> for guided user input, an interface which prompts the user for input has
> never been a good solution. You have to work very hard to make that
> convenient. 

This is easy, because they have no alternative :-)


> Have a look at lftp, for instance. 

Yes. Horrible user interface and even more horrible to program :-}


> A (still) alternative solution would be an interface to the OS to make 
> it a remote mounted folder 

There are no remote folders.


> (works for WebDAV on any modern OS, for instance) or a daemon, which
> watches and synchronizes a directory (this is how Dropbox works).

A VERY bad idea, if you have to send TB files.


> This way it feels much more integrated to the user 

It shall not look integrated. The user should think before using it.


> they can use whatever file manager they like to do the transfer

There are no file manager which supports the F*EX protocol.
Therefore I am forced to write my own clients.
I am a lazy guy: if there is already a program, I will happily use it.
Only if there is none, I program it by myself.


> or even "save" from any application (like Word, Firefox, ...) into the
> remote folder.

There are no remote folders.

-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find relative url in mixed text/html

2015-11-28 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 00:25:07 +0800, Rob Hills writes:
>All that said, I'd be interested to see specific (and hopefully
>unbiased) info about phpBB's failings...

People I know of who run different bb software say that the spammers
really prefer phpBB.  So keeping it spam free is about 4 times the
work as for, for instance, IPB.

Hackers seem to like it too -- possibly due to this:
http://defensivedepth.com/2009/03/03/anatomy-of-a-hack-the-phpbbcom-attack/

make sure you aren't vulnerable.

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


Re: askopenfilename()

2015-11-28 Thread Laura Creighton
Maybe Wei Li Jiang's  hack will work for you?
http://stackoverflow.com/questions/3375227/how-to-give-tkinter-file-dialog-focus

But then see if it works under MacOS.  I fear it will not.

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


[issue25485] Add a context manager to telnetlib.Telnet

2015-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 277824f2d133 by R David Murray in branch 'default':
#25485: Add context manager support to Telnet class.
https://hg.python.org/cpython/rev/277824f2d133

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Find relative url in mixed text/html

2015-11-28 Thread Paul Rubin
Rob Hills  writes:
> Personally, I'd rather go with something based on a language I am
> reasonably familiar with (eg Python or Java) however it seems the vast
> bulk of Forum software is based on PHP :-(

It's certainly possible to write good software in PHP, so it's mostly
a matter of the design and implementation quality.

I was on a big PhpBB forum years ago and it got very slow as the
database got large, and there were multiple incidents of database
corruption.  The board eventually switched to VBB which was a lot
better.  VBB is the best one I know of but it's not FOSS.

I'm on another one right now which uses IPB (also not FOSS) and don't
like it much (too clever for its own good).

Another one is FluxBB which is nice and lightweight and FOSS, but it's a
small forum and the software might not be up to handling a bigger one.

Some people like Discourse.  I don't like it much myself, but that's
just me.

There's certainly plenty of cheap hosting available these days (or raw
VPS) that let you run Python or whatever else you want.  But it seems to
me that forum software is something of a ghetto.  I do think there is
some written in Python but I don't remember any specifics.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find relative url in mixed text/html

2015-11-28 Thread Rob Hills
Hi Grobu,

On 28/11/15 15:07, Grobu wrote:
> Is it safe to assume that all the relative (cross) links take one of
> the following forms? :
>
> http://www.aeva.asn.au/forums/forum_posts.asp
> www.aeva.asn.au/forums/forum_posts.asp
> /forums/forum_posts.asp
> /forum_posts.asp (are you really sure about this one?)
>
> If so, and if your goal boils down to converting all instances of old
> style URLs to new style ones regardless of the context where they
> appear, why would a regex fail to meet your needs?

I'm actually not discounting anything and as I mentioned, I've already
used some regex to extract the properly-formed URLs (those starting with
http://).  I was fortunately able to find some example regex that I
could figure out enough to tweak for my purpose.  Unfortunately, my
small brain hurts whenever I try and understand what a piece of regex is
doing and I don't like having bits in my code that hurt my brain. 

BTW, that's not meant to be an invitation to someone to produce some
regex for me, if I can't find any other way of doing it, I'll try and
create my own regex and come back here if I can't get that working.

Cheers,

-- 
Rob Hills
Waikiki, Western Australia

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


Re: Python 3 virtualenvs

2015-11-28 Thread Jon Ribbens
On 2015-11-28, D.M. Procida  
wrote:
> Jon Ribbens  wrote:
>
>> On 2015-11-28, D.M. Procida 
> wrote:
>> > I have a new installation of Debian Jessie, with Python 2.7 and 3.4
>> > installed.
>> >
>> > I want to use Python 3.4 by default for most things, so I want
>> > virtualenv to create Python 3.4 virtualenvs unless I ask it to
>> > otherwise.
>> >
>> > It turns out that this seems to be inordinately complex.
>> 
>> sudo apt-get remove python-virtualenv
>> sudo apt-get install python3-virtualenv
>
> Yup, I did try installing python3-virtualenv, but it didn't appear
> actually do do anything. It didn't provide me with a virtualenv command,
> that's for sure.
>
> And pages such as https://packages.debian.org/jessie/python3-virtualenv
> are not exactly informative.
>
> Is something else required?

Hmm. Well basically the answer to your question is that you want
virtualenv to be installed by Python 3, then it will default to using
it. Debian's package management is mysterious and apparently bizarre
and frankly in respect to Python, not very good. So perhaps the best
thing to do is simply ignore it and install virtualenv yourself with:

  sudo apt-get install python3-pip
  sudo pip3 install virtualenv

... although you might want to install pip manually too.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file41186/total_ordering_ne3.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python 3 virtualenvs

2015-11-28 Thread D.M. Procida
Jon Ribbens  wrote:

> On 2015-11-28, D.M. Procida 
wrote:
> > I have a new installation of Debian Jessie, with Python 2.7 and 3.4
> > installed.
> >
> > I want to use Python 3.4 by default for most things, so I want
> > virtualenv to create Python 3.4 virtualenvs unless I ask it to
> > otherwise.
> >
> > It turns out that this seems to be inordinately complex.
> 
> sudo apt-get remove python-virtualenv
> sudo apt-get install python3-virtualenv

Yup, I did try installing python3-virtualenv, but it didn't appear
actually do do anything. It didn't provide me with a virtualenv command,
that's for sure.

And pages such as https://packages.debian.org/jessie/python3-virtualenv
are not exactly informative.

Is something else required?

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


[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Kovid Goyal

New submission from Kovid Goyal:

The Pcbuild/readme.txt file implies that it is possible to build python 
2.7.11rc1 with Visual Studio 2015 (although it is not officially supported). 
However, there are at least a couple of problems, that I have encountered so 
far:

1) timemodule.c uses timezone, tzname and daylight which are no longer defined 
in visual studio, as a quick hackish workaround, one can do
#if defined _MSC_VER && MSC_VER >= 1900
#define timezone _timezone
#define tzname _tzname
#define daylight _daylight
#endif

2) More serious, the code in posixmodule.c to check if file descriptors are 
valid no longer links, since it relies on an internal structure from microsoft 
ddls, __pioinfo that no longer exists. See
https://bugs.python.org/issue23524 for discussion about this in the python 3.x 
branch

As a quick and dirty fix one could just replace _PyVerify_fd with a stub 
implementation that does nothing for _MSC_VER >= 1900

However, a proper fix should probably be made.

--
components: Interpreter Core
messages: 20
nosy: kovidgoyal
priority: normal
severity: normal
status: open
title: Python 2.7.11rc1 not building with Visual Studio 2015
type: compile error
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes:
>I'm looking at this URL.
>https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
>
>If I hit F12 I can see tags such as these:
>And so on and so forth.  
>
>I'm wondering if someone can share a script, or a function, that will allow me 
>to pass in variables and download (or simply print) the results.  I saw a 
>sample online that I thought would work, and I made a few modifications but 
>now I keep getting a message that says: ValueError: All objects passed were 
>None
>
>Here's the script that I'm playing around with.
>
>import requests
>import pandas as pd
>from bs4 import BeautifulSoup
>
>#Get the relevant webpage set the data up for parsing
>url = "https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names;
>r = requests.get(url)
>soup=BeautifulSoup(r.content,"lxml")
>
>#set up a function to parse the "soup" for each category of information and 
>put it in a DataFrame
>def get_match_info(soup,tag,class_name):
>info_array=[]
>for info in soup.find_all('%s'%tag,attrs={'class':'%s'%class_name}):
>return pd.DataFrame(info_array)
>
>#for each category pass the above function the relevant information i.e. tag 
>names
>tag1 = get_match_info(soup,"td","title")
>tag2 = get_match_info(soup,"td","class")
>
>#Concatenate the DataFrames to present a final table of all the above info 
>match_info = pd.concat([tag1,tag2],ignore_index=False,axis=1)
>
>print match_info
>
>I'd greatly appreciate any help with this.

Post your error traceback.  If you are getting Value Errors about None,
then probably something you expect to return a match, isn't.  But without
the actual error, we cannot help much.

Laura

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


[issue25732] functools.total_ordering does not correctly implement not equal behaviour

2015-11-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Nick, I'm inclined to put this in.  Only bugs can come out of the current 
arrangement.   Do you have any further thoughts?

--
assignee:  -> ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread ryguy7272
On Saturday, November 28, 2015 at 5:28:55 PM UTC-5, Laura Creighton wrote:
> In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes:
> >I'm looking at this URL.
> >https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
> >
> >If I hit F12 I can see tags such as these:
> > > >And so on and so forth.  
> >
> >I'm wondering if someone can share a script, or a function, that will allow 
> >me to pass in variables and download (or simply print) the results.  I saw a 
> >sample online that I thought would work, and I made a few modifications but 
> >now I keep getting a message that says: ValueError: All objects passed were 
> >None
> >
> >Here's the script that I'm playing around with.
> >
> >import requests
> >import pandas as pd
> >from bs4 import BeautifulSoup
> >
> >#Get the relevant webpage set the data up for parsing
> >url = "https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names;
> >r = requests.get(url)
> >soup=BeautifulSoup(r.content,"lxml")
> >
> >#set up a function to parse the "soup" for each category of information and 
> >put it in a DataFrame
> >def get_match_info(soup,tag,class_name):
> >info_array=[]
> >for info in soup.find_all('%s'%tag,attrs={'class':'%s'%class_name}):
> >return pd.DataFrame(info_array)
> >
> >#for each category pass the above function the relevant information i.e. tag 
> >names
> >tag1 = get_match_info(soup,"td","title")
> >tag2 = get_match_info(soup,"td","class")
> >
> >#Concatenate the DataFrames to present a final table of all the above info 
> >match_info = pd.concat([tag1,tag2],ignore_index=False,axis=1)
> >
> >print match_info
> >
> >I'd greatly appreciate any help with this.
> 
> Post your error traceback.  If you are getting Value Errors about None,
> then probably something you expect to return a match, isn't.  But without
> the actual error, we cannot help much.
> 
> Laura


Ok.  How do I post the error traceback?  I'm using Spyder Python 2.7.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23150] urllib parse incorrect handing of params

2015-11-28 Thread Martin Panter

Martin Panter added the comment:

Marking as Python 3 since you mentioned urllib.parse, rather than just urllib. 
However you need to be more specific. We already have a urllib.parse.urlsplit() 
function which seems to do what you want:

>>> urllib.parse.urlsplit("http://example.com/;;).path
'/;'

I see that the “params” bit can be dropped by urljoin(). My proposal in Issue 
22852 could probably be adapted to help with that.

--
nosy: +martin.panter
stage:  -> test needed
versions: +Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2015-11-28 Thread Jeroen Demeyer

Changes by Jeroen Demeyer :


--
type:  -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 14:37:26 -0800, ryguy7272 writes:
>On Saturday, November 28, 2015 at 5:28:55 PM UTC-5, Laura Creighton wrote:
>> In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes:
>> >I'm looking at this URL.
>> >https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
>> >
>> >If I hit F12 I can see tags such as these:
>> >> >> >And so on and so forth.  
>> >
>> >I'm wondering if someone can share a script, or a function, that will allow 
>> >me to pass in variables and download (or simply print) the results.  I saw 
>> >a sample online that I thought would work, and I made a few modifications 
>> >but now I keep getting a message that says: ValueError: All objects passed 
>> >were None
>> >
>> >Here's the script that I'm playing around with.
>> >
>> >import requests
>> >import pandas as pd
>> >from bs4 import BeautifulSoup
>> >
>> >#Get the relevant webpage set the data up for parsing
>> >url = "https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names;
>> >r = requests.get(url)
>> >soup=BeautifulSoup(r.content,"lxml")
>> >
>> >#set up a function to parse the "soup" for each category of information and 
>> >put it in a DataFrame
>> >def get_match_info(soup,tag,class_name):
>> >info_array=[]
>> >for info in soup.find_all('%s'%tag,attrs={'class':'%s'%class_name}):
>> >return pd.DataFrame(info_array)
>> >
>> >#for each category pass the above function the relevant information i.e. 
>> >tag names
>> >tag1 = get_match_info(soup,"td","title")
>> >tag2 = get_match_info(soup,"td","class")
>> >
>> >#Concatenate the DataFrames to present a final table of all the above info 
>> >match_info = pd.concat([tag1,tag2],ignore_index=False,axis=1)
>> >
>> >print match_info
>> >
>> >I'd greatly appreciate any help with this.
>> 
>> Post your error traceback.  If you are getting Value Errors about None,
>> then probably something you expect to return a match, isn't.  But without
>> the actual error, we cannot help much.
>> 
>> Laura
>
>
>Ok.  How do I post the error traceback?  I'm using Spyder Python 2.7.

You cut and paste it out of wherever you are reading it, and paste it
into the email, along with your code, also cut and pasted from somewhere
(like an editor).  That way we get the exact code that caused the exact
traceback you are getting.

Laura

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


[issue25754] Test test_rlcompleter failed if run twice

2015-11-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2e889344436e by Martin Panter in branch 'default':
Issue #25754: Allow test_rlcompleter to be run multiple times
https://hg.python.org/cpython/rev/2e889344436e

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Generate config file from template using Python search and replace.

2015-11-28 Thread Peter Otten
Mr Zaug wrote:

> I need to generate a config file based on an existing "template" file. I
> need to replace a set of strings with other strings globally in the
> generated file.
> 
> Here is a snippet of the template file, where CONTENT_PATH and DAMPATH are
> two "placeholders" or variables. There are several other such
> placeholders.
> 
>   $include "_dispatcher_publish_filters.any"
>   /1000 { /type "allow"  /glob "* /CONTENT_PATH/*.html*" }
>   /1001 { /type "allow"  /glob "POST /DAMPATH/www/*.html *" }
> 
> The script's user will be asked to type in unique values when prompted for
> DAMPATH or CONTENT_PATH.
> 
> Since I know the variables themselves are not going to change (because the
> contents of the template file don't spontaneously change) should I be
> using regex to search for them or is there a better way? I was planning on
> using re.sub but I don't know whether that's the best way. Here's what my
> script looks like today.
> 
> from sys import argv
> import re
> from os.path import exists
> 
> script, template_file = argv
> print "Opening the template file..."
> 
> in_file = open(template_file)
> lines = in_file.readlines()
> 
> print "What is the serial number of the site?",
> _NNN = raw_input()
> 
> print "What is the brand, or product name?",
> _BRAND = raw_input()
> 
> print "What is the content path?",
> _CONTENT_PATH = raw_input()
> 
> out_file = open(_nnn + _brand + "_farm.any", 'w')
> 
> for line in lines:
>re.sub('NNN', _NNN, line)
>re.sub('BRAND, _BRAND', line)
>re.sub('CONTENT_PATH', _CONTENT_PATH, line)
> 
> out_file.close()

There are many templating systems out there. Pick the one that suits you 
best. A very basic one is str.format():

>>> "{foo} {bar}".format(foo=1, bar=2)
'1 2'

Here's what your script might become if you choose that one:

$ cat interactive_template.txt
  $include "_dispatcher_publish_filters.any"
  /1000 {{ /type "allow"  /glob "* /{CONTENT_PATH}/*.html*" }}
  /1001 {{ /type "allow"  /glob "POST /{DAMPATH}/www/*.html *" }}
$ cat interactive_template.py

try:
format_map = str.format_map
except AttributeError:  # python 2 compatibility
import string

def format_map(text, lookup):
return string.Formatter().vformat(text, (), lookup)
input = raw_input


class Lookup(dict):
def __missing__(self, key):
self[key] = value = input("{}: ".format(key))
return value


def main():
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("template_file")
parser.add_argument("generated_file", nargs="?")
args = parser.parse_args()

with open(args.template_file) as instream:
template_text = instream.read()

lookup = Lookup()
generated_text = format_map(template_text, lookup)
generated_file = args.generated_file
if generated_file is None:
generated_file = format_map("{nnn}{brand}_farm.any", lookup)
print("Writing {}".format(generated_file))
with open(generated_file, "w") as outstream:
outstream.write(generated_text)


if __name__ == "__main__":
main()
$ python interactive_template.py interactive_template.txt
CONTENT_PATH: foo
DAMPATH: bar
nnn: baz
brand: ham
Writing bazham_farm.any
$ cat bazham_farm.any 
  $include "_dispatcher_publish_filters.any"
  /1000 { /type "allow"  /glob "* /foo/*.html*" }
  /1001 { /type "allow"  /glob "POST /bar/www/*.html *" }


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


[issue25754] Test test_rlcompleter failed if run twice

2015-11-28 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread SilentGhost

Changes by SilentGhost :


--
components: +Build, Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Steve Dower

Steve Dower added the comment:

The proper fix is to remove any hint in the readme file that this will work. 
Building 2.7 with VS 2015 will not work unless someone forks CPython and makes 
the updates themselves.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: An Educational Software Platform written in Python

2015-11-28 Thread Joel Goldstick
On Sat, Nov 28, 2015 at 11:39 AM, Marko Rauhamaa  wrote:

> Cai Gengyang :
>
> > Can I create something like this entirely in Python,
>
> Absolutely. It will only take ten to one hundred years for one person to
> create.
>
>
> Marko
> --
> https://mail.python.org/mailman/listinfo/python-list
>


Cai,

Start small.  write some 10 line programs.  Then some 30 line programs.
 then write 100 more usefull programs.  Then you will understand what it is
you can do or can't.
-- 
Joel Goldstick
http://joelgoldstick.com/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Generate config file from template using Python search and replace.

2015-11-28 Thread Mr Zaug
I need to generate a config file based on an existing "template" file. I need 
to replace a set of strings with other strings globally in the generated file.

Here is a snippet of the template file, where CONTENT_PATH and DAMPATH are two 
"placeholders" or variables. There are several other such placeholders.

  $include "_dispatcher_publish_filters.any"
  /1000 { /type "allow"  /glob "* /CONTENT_PATH/*.html*" }
  /1001 { /type "allow"  /glob "POST /DAMPATH/www/*.html *" }

The script's user will be asked to type in unique values when prompted for 
DAMPATH or CONTENT_PATH.

Since I know the variables themselves are not going to change (because the 
contents of the template file don't spontaneously change) should I be using 
regex to search for them or is there a better way? I was planning on using 
re.sub but I don't know whether that's the best way. Here's what my script 
looks like today.

from sys import argv
import re
from os.path import exists

script, template_file = argv
print "Opening the template file..."

in_file = open(template_file)
lines = in_file.readlines()

print "What is the serial number of the site?",
_NNN = raw_input()

print "What is the brand, or product name?",
_BRAND = raw_input()

print "What is the content path?",
_CONTENT_PATH = raw_input()

out_file = open(_nnn + _brand + "_farm.any", 'w')

for line in lines:
   re.sub('NNN', _NNN, line)
   re.sub('BRAND, _BRAND', line)
   re.sub('CONTENT_PATH', _CONTENT_PATH, line)

out_file.close()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generate config file from template using Python search and replace.

2015-11-28 Thread Mr Zaug
I should mention the template file is small, just 98 lines long and the working 
config file will be the same size.
-- 
https://mail.python.org/mailman/listinfo/python-list


Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread ryguy7272
I'm looking at this URL.
https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names

If I hit F12 I can see tags such as these:
https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names;
r = requests.get(url)
soup=BeautifulSoup(r.content,"lxml")

#set up a function to parse the "soup" for each category of information and put 
it in a DataFrame
def get_match_info(soup,tag,class_name):
info_array=[]
for info in soup.find_all('%s'%tag,attrs={'class':'%s'%class_name}):
return pd.DataFrame(info_array)

#for each category pass the above function the relevant information i.e. tag 
names
tag1 = get_match_info(soup,"td","title")
tag2 = get_match_info(soup,"td","class")

#Concatenate the DataFrames to present a final table of all the above info 
match_info = pd.concat([tag1,tag2],ignore_index=False,axis=1)

print match_info

I'd greatly appreciate any help with this.

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


[issue17620] Python interactive console doesn't use sys.stdin for input

2015-11-28 Thread Adam Bartoš

Adam Bartoš added the comment:

I've formulated a proposal regarding this issue: 
https://mail.python.org/pipermail/python-dev/2015-November/142246.html . Does 
it make sense?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2015-11-28 Thread Martin Panter

Martin Panter added the comment:

I think it is better to return None without an exception, to keep the current 
behaviour, and because that’s what the documentation implies.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25717] tempfile.TemporaryFile fails when dir option set to directory residing on host OS mount

2015-11-28 Thread Martin Panter

Martin Panter added the comment:

Antoine or Bohuslav, since you were involved in Issue 21679, would you be able 
to comment on fstat-failure.patch, which reverts back to ignoring most fstat() 
errors? The problem here is that fstat() seems to fail if the directory entry 
has been unlinked, and the file is on a Virtual Box shared folder filesystem.

--
nosy: +bkabrda, pitrou
stage:  -> patch review
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24363] httplib fails to handle semivalid HTTP headers

2015-11-28 Thread Martin Panter

Martin Panter added the comment:

Since the Python 2 and Python 3 branches are different, two different patches 
would be needed here. Perhaps they could share common test cases though.

Michael: I presume your proposal is for Python 2. I don’t understand the 
re.findall() expression; is there a clearer way to do whatever it is trying to 
do (or failing that, explain it in a comment)? It looks like you are trying to 
skip over spaces at the start of the first header field name. Also, it seems to 
drop support for lines folded with tabs rather than spaces.

David: The headers-only mode wouldn’t make much difference because it only 
affects parsing the “payload”. As far as the email package is concerned, the 
payload should always be empty when used by HTTP’s parse_headers().

The simplest fix (at least for the Python 3 code) would be to check each line 
against email.feedparser.headerRE before adding it to the list of lines in the 
HTTP package. This would prevent the email parser from bailing from the header 
section early, which is the main problem.

But that does seem like a bad hack and wouldn’t treat the offending line as a 
folded line, which Cory and David want. So I guess we need to make the email 
parser more flexible instead. Maybe a private FeedParser._parse_header_lines() 
method or something, that replaces feed() and close(), and defers most of the 
processing directly to _parse_headers().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Steven D'Aprano
On Sun, 29 Nov 2015 09:03 am, ryguy7272 wrote:

> I'm looking at this URL.
> https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names

Don't screen-scrape Wikipedia. Just don't. They have an official API for
downloading content, use it. There's even a Python library for downloading
from Wikipedia and other Mediawiki sites:

https://www.mediawiki.org/wiki/Manual:Pywikibot

Wikimedia does a fantastic job, for free, and automated screen-scraping
hurts their ability to provide that service. It is rude and anti-social.
Please don't do it.



-- 
Steven

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


Re: python response slow when running external DLL

2015-11-28 Thread jfong
Peter Otten at 2015/11/28 UTC+8 6:14:09PM wrote:
> No, the point of both recipes is that tkinter operations are only ever 
> invoked from the main thread. The main thread has polling code that 
> repeatedly looks if there are results from the helper thread. As far I 
> understand the polling method has the structure
> 
> f():
># did we get something back from the other thread?
># a queue is used to avoid race conditions
> 
># if yes react.
># var_status.set() goes here
> 
># reschedule f to run again in a few millisecs; 
># that's what after() does

Have no idea how the main thread poll on all those events (or it use a queue)?
All I know now is that the main thread(mainloop()?) can be easily blocked by 
event handlers if the handler didn't run as a separate thread.

> > .
> > .
> > #do the rest
> > var_status.set('Download...')
> > _thread.start_new_thread(td_download, ())  #must use threading
> > 
> > def td_download():
> > result = mydll.SayHello()
> > if result:
> > var_status.set("Download Fail at %s" % hex(result))
> > showerror('Romter', 'Download Fail')
> > else:
> > var_status.set('Download OK')
> > showinfo('Romter', 'Download OK')
> 
> As td_download() runs in the other thread the var_status.set() methods are 
> problematic.

No idea what kind of problem it will encounter. Can you explain?

> Another complication that inevitably comes with concurrency: what if the 
> user triggers another download while one download is already running? If you 
> don't keep track of all downloads the message will already switch to 
> "Download OK" while one download is still running.

Hummm...this thought never comes to my mind. After take a quick test I found, 
you are right, a second "download" was triggered immediately. That's a shock to 
me. I suppose the same event shouldn't be triggered again, or at least not 
triggered immediately, before its previous handler was completed. ...I will 
take a check later on Borland C++ builder to see how it reacts!

Anyway to prevent this happens? if Python didn't take care it for us.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25760] TextWrapper fails to split 'two-and-a-half-hour' correctly

2015-11-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Already fixed in issue22687.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25760] TextWrapper fails to split 'two-and-a-half-hour' correctly

2015-11-28 Thread Samwyse

New submission from Samwyse:

Single character words in a hyphenated phrase are not split correctly.  The 
root issue it the wordsep_re class variable.  To reproduce, run the following:

>>> import textwrap
>>> textwrap.TextWrapper.wordsep_re.split('two-and-a-half-hour')
['', 'two-', 'and-a', '-half-', 'hour']

It works if 'a' is replaces with two or more alphabetic characters.

>>> textwrap.TextWrapper.wordsep_re.split('two-and-aa-half-hour')
['', 'two-', '', 'and-', '', 'aa-', '', 'half-', 'hour']

The problem is in this part of the pattern:  (?=\w+[^0-9\W])

I confess that I don't understand the situation that would require that 
complicated of a pattern.  Why wouldn't (?=\w) would work?

--
components: Library (Lib)
messages: 28
nosy: samwyse
priority: normal
severity: normal
status: open
title: TextWrapper fails to split 'two-and-a-half-hour' correctly
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: python response slow when running external DLL

2015-11-28 Thread jfong
Laura Creighton at 2015/11/28 UTC+8 6:52:25PM wrote:
> I never saw the reply that Peter is replying to.
> The threading module constructs a higher level interface on top of the
> low level thread module.  Thus it is the preferred way to go for
> standard Python code -- and even Fredrik's recipe contains the
> line:
>   import thread # should use the threading module instead!
> 
> Laura
Hi! Laura, 

takes the porting of an old BCB GUI program as an exercise in my learning 
python, I just quickly grab the required tools (mainly the tkinter) in python 
to complete this "work" and get a feeling of how python performs on doing this. 
Most of my knowledge of python comes from Mark Lutz's book "Learning python" 
and "Programming python". I didn't dive into this language deeply yet. There 
are topics about "_thread" and "threading" modules in the book and I just pick 
the lower level one for this because the "threading" is based on the "_thread".

Thanks for your note and link.

--Jach


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


[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Kovid Goyal

Kovid Goyal added the comment:

OK, I had hoped to avoid having to maintain my own fork of python 2 for a while 
longer, but, I guess not. 

Could you at least tell me if there are any other issues I should be aware of, 
to avoid me having to search through the python 3 sourcecode/commit history. 

I will be happy to make my work public so others can benefit from it as well.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread ryguy7272
On Saturday, November 28, 2015 at 8:59:04 PM UTC-5, Steven D'Aprano wrote:
> On Sun, 29 Nov 2015 09:03 am, ryguy7272 wrote:
> 
> > I'm looking at this URL.
> > https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
> 
> Don't screen-scrape Wikipedia. Just don't. They have an official API for
> downloading content, use it. There's even a Python library for downloading
> from Wikipedia and other Mediawiki sites:
> 
> https://www.mediawiki.org/wiki/Manual:Pywikibot
> 
> Wikimedia does a fantastic job, for free, and automated screen-scraping
> hurts their ability to provide that service. It is rude and anti-social.
> Please don't do it.
> 
> 
> 
> -- 
> Steven

Thanks Steven.  Do you know of a good tutorial for learning about Wikipedia 
APIs?  I'm not sure where to get started on this topic.  I did some Google 
searches, but didn't come up with a lot of useful info...not much actually...
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue5784] raw deflate format and zlib module

2015-11-28 Thread Martin Panter

Martin Panter added the comment:

Here is a patch with the following changes:

* Clarified that wbits affects the container format as well as windows size
* Undid some word wrapping to make the diff simpler
* Added zero and 32 + n for decompression
* Added full list of options under decompressobj(), and link decompress() to 
that. Otherwise we end up saying decompression generates a header, when it 
really parses the header.
* Added tests for various wbits values
* Compressing with window bits = 8 not actually supported (Zlib bumps it to 9: 
.
 The change log says “Force windowBits > 8 to avoid a bug in the encoder for a 
window size of 256 bytes”.)
* Updated doc strings

--
keywords: +patch
versions: +Python 3.5, Python 3.6 -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file41187/zlib-wbits.v3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Steve Dower

Steve Dower added the comment:

Not off the top of my head, but you only really need to look at my commits, and 
looking for issues assigned to me is an easy way to find those.

Most of the issues are obvious once you start trying to build.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Kovid Goyal

Kovid Goyal added the comment:

I have it building with just two simple patches:

https://github.com/kovidgoyal/cpython/commit/fd1ceca4f21135f12ceb72f37d4ac5ea1576594d

https://github.com/kovidgoyal/cpython/commit/edb740218c04b38aa0f385188103100a972d608c

However, in developing the patches, I discovered what looks like a bug in the 
CRT close() function. If you double close a valid file descriptor it crashes, 
rather than calling the invalid parameter handler.

python -c "import os; os.close(2); os.close(2)"

crashes. This is true for python 2.7.10 built against VS 2008 as well. This 
contrasts with the behavior of double close() on other operating systems, where 
it sets errno to EBADF and does not crash.

I have not tested it with python 3.5, but I assume the bug is present there as 
well.

--
components:  -Build, Windows

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23200] Deprecate the zlib decompressor’s flush() method

2015-11-28 Thread Martin Panter

Martin Panter added the comment:

And regarding other internal buffers and state, calling flush() or decompress() 
guarantees you get as much data as possible, but there is no error checking. 
You have to check the eof attribute to ensure everything is done, otherwise I 
don’t think there is a way to differentiate a truncated stream from a properly 
ended stream.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com