[no subject]

2017-04-07 Thread David Shi via Python-list


I was using IPython notebooks.  All the sudden, it asks for password or token.
I did not set any password or token.
How do I get back to use my IPython notebooks?
Looking forward to hearing from you.
Regards.
David
-- 
https://mail.python.org/mailman/listinfo/python-list


A Python solution for turning a web page into Pandas DataFrame table

2017-04-07 Thread David Shi via Python-list


Is there a Python solution for turning a web page into Pandas DataFrame table?
Looking forward to hearing from you.
Regards.
David
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A Python solution for turning a web page into Pandas DataFrame table

2017-04-07 Thread Steve D'Aprano
On Fri, 7 Apr 2017 07:08 pm, David Shi wrote:

> 
> 
> Is there a Python solution for turning a web page into Pandas DataFrame
> table? Looking forward to hearing from you.

What, *any* web page? Like this?

http://www.math.ubc.ca/~cass/courses/m308-03b/projects-03b/skinner/ex-dimension-sierpinski_gasket.htm



What exactly would you expect to go into the dataframe?


I think you need to be more specific. What web page, containing what sort of
data, and what do you expect to get out of it?


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


django float round tripping

2017-04-07 Thread Robin Becker

I've been having problems with django FloatFields not round tripping properly; 
eg

field = 0.018903438896219302

gets saved and returns as

0.0189034388962193

It turns out that this is a property of the MySQLdb python interface where in 
converter.py we have the definition


def Float2Str(o, d):
return '%.15g' % o

if I change this to

def Float2Str(o, d):
return repr(o)

I do seem able to get reproducibility.

Are there any downsides to making this change?
--
Robin Becker

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


Re: PYTHON

2017-04-07 Thread Mario R. Osorio
On Thursday, April 6, 2017 at 8:43:48 AM UTC-4, alders...@gmail.com wrote:
> Hello, how can I start programming?

http://www.lmgtfy.com/?q=Hello%2C+how+can+I+start+programming%3F
-- 
https://mail.python.org/mailman/listinfo/python-list


Issues downloading python.

2017-04-07 Thread Brandon Mace
I have downloaded python onto a DELL laptop, but it will not run. I have
tried to install it multiple times but each time it does not work so I try
again. This time it has come up with a system error and that "The program
can't start because api-ms-win-crt-runtime-[1-1-0.dlll is missing"
What can I do to make the program run?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ANN: pyftpdlib 1.5.2 released

2017-04-07 Thread Jack Jansen
It looks as though you posted this message with the “about” paragraph from a 
different library? I looked at the web site, and pyftpdlib indeed seems to be 
an ftp daemon, as the name suggests, not a system load package….

Regards,
Jack

> On 06 Apr 2017, at 13:06, Giampaolo Rodola'  wrote:
> 
> Hello all,
> I'm glad to announce the release of pyftpdlib 1.5.2:
> https://github.com/giampaolo/pyftpdlib
> 
> About
> =
> 
> pyftpdlib (process and system utilities) is a cross-platform library for
> retrieving information on running processes and system utilization (CPU,
> memory, disks, network) in Python. It is useful mainly for system
> monitoring, profiling and limiting process resources and management of
> running processes. It implements many functionalities offered by command
> line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free,
> nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It
> currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD and
> NetBSD, both 32-bit and 64-bit architectures, with Python versions from 2.6
> to 3.5 (users of Python 2.4 and 2.5 may use 2.1.3 version). PyPy is also
> known to work.
> 
> What's new
> ==
> 
> **Enhancements**
> 
> - #378: SSL security was improved by disabling SSLv2, SSLv3 and
> SSL_COMPRESSION
>  features. New TLS_FTPHandler's ssl_options class attribute was added.
> - #380: AbstractedFS.listdir() can now return also a generator (not only a
>  list).
> 
> **Bug fixes**
> 
> - #367: ThreadedFTPServer no longer hangs if close_all() is called.
> - #394: ETIMEDOUT is not treated as an alias for "connection lost".
> - #400: QUIT can raise KeyError in case the user hasn't logged in yet and
> sends
>  QUIT command.
> 
> Links
> =
> 
> - Home page: https://github.com/giampaolo/pyftpdlib
> - Download: https://pypi.python.org/pypi/pyftpdlib
> - Documentation: http://pythonhosted.org/pyftpdlib
> - What's new: https://github.com/giampaolo/pyftpdlib/blob/master/HISTORY.rst
> 
> --
> 
> Giampaolo - http://grodola.blogspot.com
> -- 
> https://mail.python.org/mailman/listinfo/python-announce-list
> 
>Support the Python Software Foundation:
>http://www.python.org/psf/donations/

--
Jack Jansen, , http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma Goldman



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


Re: Issues downloading python.

2017-04-07 Thread mm0fmf

On 07/04/2017 15:57, Brandon Mace wrote:

I have downloaded python onto a DELL laptop, but it will not run. I have
tried to install it multiple times but each time it does not work so I try
again. This time it has come up with a system error and that "The program
can't start because api-ms-win-crt-runtime-[1-1-0.dlll is missing"
What can I do to make the program run?



Install the missing file.

https://support.microsoft.com/en-us/kb/2999226
--
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2017: Tickets are now available

2017-04-07 Thread Alexander Hendorf
You can now buy regular tickets 
for Europe’s largest Python conference.

After the early bird tickets sold out in just eight hours,
standard rate tickets are now available:

Student: EUR 130.- incl. VAT 
(only available for students and postdocs; please bring your student card)

Personal: EUR 375.- incl. VAT 
(for people enjoying Python from home)

Business: EUR 555.- excl. VAT / 677.10 incl. VAT 
(for people using Python to make a living)

Tickets can be purchased via the EuroPython website.
https://ep2017.europython.eu/en/registration/buy-tickets/

Please help us spreading the news by forwarding this mail 
or re-tweeting, thanks!
https://twitter.com/europython/status/850368483061846018


Enjoy,

EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/


PS: please remember to submit your proposals for the conference. 
https://ep2017.europython.eu/en/call-for-proposals/
There are only a few days left for submission. 
The deadline is (Easter) Sunday, April 16th.
-- 
https://mail.python.org/mailman/listinfo/python-list


Elastic Search

2017-04-07 Thread Keith Anthony
I need some insightful examples of elastic search, using REGEX ...
And using REST.
-- 
https://mail.python.org/mailman/listinfo/python-list


Find out which module a class came from

2017-04-07 Thread Tobiah
I was viewing the python source for a program at work and
came across a class name that I knew my company had written:

import mycmp1
import mycmp2
import mycmp3
import mycmp4
import mycmp5

foo = FooClass()


So I knew that FooClass was defined in one of those imports, but
I thought it would be tedious to track down the location of all
of those modules (is module.__file___ the best way) and scan them
for the class definition.  Is there a better way to find the 
definition of FooClass()?


Thanks!



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


Re: Find out which module a class came from

2017-04-07 Thread Chris Angelico
On Sat, Apr 8, 2017 at 6:24 AM, Tobiah  wrote:
> I was viewing the python source for a program at work and
> came across a class name that I knew my company had written:
>
> import mycmp1
> import mycmp2
> import mycmp3
> import mycmp4
> import mycmp5
>
> foo = FooClass()
>
>
> So I knew that FooClass was defined in one of those imports, but
> I thought it would be tedious to track down the location of all
> of those modules (is module.__file___ the best way) and scan them
> for the class definition.  Is there a better way to find the
> definition of FooClass()?

If they're just "import modulename", then FooClass won't be defined
unless it's been injected into the builtins or something. Are they
"from mycmp1 import *"?

Normally, you should be able to just look at FooClass.__module__ to
see where it's been created. But if your module layout is messy, that
might not be sufficient information.

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


Re: Elastic Search

2017-04-07 Thread breamoreboy
On Friday, April 7, 2017 at 9:16:51 PM UTC+1, Keith Anthony wrote:
> I need some insightful examples of elastic search, using REGEX ...
> And using REST.

What was wrong with the hits that you got from your search engine of choice?

Kindest regards.

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


Re: Temporary variables in list comprehensions

2017-04-07 Thread Roel Schroeven

Lele Gaifax schreef op 6/04/2017 20:07:

Piet van Oostrum  writes:


It is a poor man's 'let'. It would be nice if python had a real 'let'
construction. Or for example:

[(tmp, tmp + 1) for x in data with tmp = expensive_calculation(x)]

Alas!


It would be nice indeed!

Or even

  [(tmp, tmp + 1) for x in data
   with expensive_calculation(x) as tmp
   if tmp is not None]



Perhaps this:

[(tmp, tmp + 1) for tmp in
 (expensive_calculation(x) for x in data)
 if tmp is not None]

A bit less elegant, but works right now.


--
Roel Schroeven

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


Re: Elastic Search

2017-04-07 Thread Steve D'Aprano
On Sat, 8 Apr 2017 06:15 am, Keith Anthony wrote:

> I need some insightful examples of elastic search, using REGEX ...
> And using REST.

What's elastic search?

And what does this have to do with Python?

Can you be more specific rather than assume we know what you want? What have
you tried, what don't you understand, what have you searched for, etc.

We're all volunteers here, we aren't paid to decipher people's mysterious
questions. If deciphering the question is too hard, you won't find many
people willing to spend the time and effort trying to solve it. The better
the question you ask, the better the answers you will probably get.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Find out which module a class came from

2017-04-07 Thread Steve D'Aprano
On Sat, 8 Apr 2017 06:24 am, Tobiah wrote:

> I was viewing the python source for a program at work and
> came across a class name that I knew my company had written:
> 
> import mycmp1
> import mycmp2
> import mycmp3
> import mycmp4
> import mycmp5
> 
> foo = FooClass()
> 
> 
> So I knew that FooClass was defined in one of those imports,

No you don't. You know the opposite: FooClass must be defined *locally* in
the current file, because the name isn't fully qualified.

(Well, I say "must" but technically that's not *quite* true... it is
possible that one of the modules mycmp1 etc. could inject FooClass into
your module, but that's pretty unlikely.)

If you have:

from mycmp1 import FooClass
from mycmp2 import FooClass
# etc.

foo = FooClass

then the last import wins. If you have wild-card imports:

from mycmp1 import *
from mycmp2 import *
# etc.

then (1) your dev team should be stoned to death with ripe figs (so it takes
longer), and (2) the same rule applies again: the last module importing a
FooClass will override any previous imports of the same name.


> but 
> I thought it would be tedious to track down the location of all
> of those modules (is module.__file___ the best way) 

I don't know about "best". Actually having a well-structured code base is
probably best. But if you are stuck with a tangled mess, then
module.__file__ is probably your least-worst option.


> and scan them 
> for the class definition.  Is there a better way to find the
> definition of FooClass()?

Keep in mind that a sufficiently perverted and incompetent programmer can
*accidentally* duplicate the trickiest obfuscation used by intentionally
malicious programmers, so there is no guarantee. And if you are trying to
analyse malware, or code written by somebody intentionally obfuscating the
source so as to guarantee job-security, all bets are off.

But for merely ordinary obfuscation caused by poor design, your best bet is
probably to inspect Foo.__module__.

You can also try:

inspect.getsource(FooClass)
inspect.getsourcefile(FooClass)



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Find out which module a class came from

2017-04-07 Thread Rick Johnson
On Friday, April 7, 2017 at 7:49:11 PM UTC-5, Steve D'Aprano wrote:
> But for merely ordinary obfuscation caused by poor design,
> your best bet is probably to inspect Foo.__module__.
> 
> You can also try:
> 
> inspect.getsource(FooClass)
> inspect.getsourcefile(FooClass)

Hmm, I tried that code but all i got was a nameError. 

>>> inspect.getsource(FooClass)

Traceback (most recent call last):
  File "", line 1, in 
inspect.getsource(FooClass)
NameError: name 'inspect' is not defined

>>> inspect.getsourcefile(FooClass)

Traceback (most recent call last):
  File "", line 1, in 
inspect.getsourcefile(FooClass)
NameError: name 'inspect' is not defined

You must be using the Python version that has batteries _and_
imports included.

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


Re: Temporary variables in list comprehensions

2017-04-07 Thread Jussi Piitulainen
Roel Schroeven writes:

> Lele Gaifax schreef op 6/04/2017 20:07:
>> Piet van Oostrum  writes:
>>
>>> It is a poor man's 'let'. It would be nice if python had a real 'let'
>>> construction. Or for example:
>>>
>>> [(tmp, tmp + 1) for x in data with tmp = expensive_calculation(x)]
>>>
>>> Alas!
>>
>> It would be nice indeed!
>>
>> Or even
>>
>>   [(tmp, tmp + 1) for x in data
>>with expensive_calculation(x) as tmp
>>if tmp is not None]
>>
>
> Perhaps this:
>
> [(tmp, tmp + 1) for tmp in
>  (expensive_calculation(x) for x in data)
>  if tmp is not None]
>
> A bit less elegant, but works right now.

The "poor man's let" works right now.
-- 
https://mail.python.org/mailman/listinfo/python-list