Re: collect2: ld returned 1 exit status when building from source

2016-09-12 Thread dieter
Steve D'Aprano  writes:
> ...
> but the build still fails, with the same errors:
>
>
> Python/dtrace_stubs.o: In function `PyDTrace_LINE':
> /home/steve/python/python-dev/cpython/Include/pydtrace.h:25: multiple
> definition of `PyDTrace_LINE'
> Python/ceval.o:/home/steve/python/python-dev/cpython/Include/pydtrace.h:25:
> first defined here
>   [ ... many, many, many more similar errors ... ]
>
> collect2: ld returned 1 exit status
> make: *** [Programs/_freeze_importlib] Error 1

Looks as if some error has slipped in the sources: you should not have multiple
conflicting definitions for the same symbol (e.g. "PyDTrace_LINE").
Alternatively, your built might fetch wrong headers (e.g. headers
for a different Python version).

I would look at the places from which the "multiple definition"s come
and try to find out why there are multiple of them.

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


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread not1xor1

Il 12/09/2016 04:26, Chris Angelico ha scritto:

So whoever created the Universe also created the Creator...

No, God isn't part of the universe, any more than an author is part of
his novel.


your logic is based on the assumption that the _existance_ itself, 
i.e. the mere presence of something, can be explained only by the 
presence of a "creator"


but such agent must  _exists_ to be able to perform 
any act of creation, so, according to the given logic, she-he-it 
(-self) must have been created by some other kind of agent


so there are 0x10 chances:
- 0x00 an infinitive hierarchy of "creators"
   (you might get a stack overflow)
- 0x01 the universe has always been there an the need of an "agent"
   is just due to the classical "every event is explained by
   a purposeful agent" cognitive fallacy

I do not know if the 0x00 item is the right one, but I'm sure that a 
possible 'creator' (just one hierarchical level over our present 
universe) would likely be quite different from all the various ones 
mankind imagined in the course of millennia and would strongly 
disapprove all the psychological projections about her-his-its will 
and the evil done in her-his-its name :-)


p.s. I apologize for my poor English
--
bye
!(!1|1)
--
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread Robin Becker

On 11/09/2016 21:30, Sven R. Kunze wrote:

On 10.09.2016 15:00, Chris Angelico wrote:

Some things are absolute hard facts. There is no way in which 1 will
ever be greater than 2, ergo "1 is less than 2" is strictly true, and
not a matter of opinion. If you hear someone trying to claim
otherwise, would you let him have his opinion, or would you treat it
as incorrect?


I don't know exactly if it's clear that one would need to make a distinction
between real/physical-world facts and pure-logic facts.

"1 < 2" is by definition "true" (construction of natural numbers) not by
real-world evidence. IIRC, the quote is about real-world matters.



as I understand it, the universe is said by some to be a long lived random 
fluctuation of nothing and it is said that observers make a real difference to 
reality. The existence of arithmetic etc is somewhat moot under such assumptions.


Also presumably there are other constructions of 'our' familiar arithmetic. 
Perhaps someone could probably make an arithmetic where most of standard ZF is 
true except for 1<2.  Gödel definitely says there are holes in arithmetic :)


-possibly non-existently yrs-
Robin Becker

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


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread Eric S. Johansson


On 9/11/2016 10:26 PM, Chris Angelico wrote:
> No, God isn't part of the universe, any more than an author is part of
> his novel.
>
as any fiction writer will tell you, the author is found in one or more
of their characters.
-- 
https://mail.python.org/mailman/listinfo/python-list


Expression can be simplified on list

2016-09-12 Thread Daiyue Weng
Hi, I found that when I tried to make an equality test on empty like,

if errors == []:

PyCharm always warns me,

Expression can be simplified.

I am wondering what's wrong and how to fix this?

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


Re: Expression can be simplified on list

2016-09-12 Thread Chris Angelico
On Mon, Sep 12, 2016 at 9:14 PM, Daiyue Weng  wrote:
> Hi, I found that when I tried to make an equality test on empty like,
>
> if errors == []:
>
> PyCharm always warns me,
>
> Expression can be simplified.
>
> I am wondering what's wrong and how to fix this?
>

If you know that 'errors' is always going to be a list, you can check
for emptiness thus:

if not errors:

PyCharm recommends this syntax rather than the comparison with a
newly-created empty list. Your code has to actually construct and
dispose of a list, just for the comparison.

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


Problem with difflib SequenceMatcher

2016-09-12 Thread Jay
Hello

I am having an odd problem with difflib.SequenceMatcher. Sample code below:

The strings "src" and "trg" differ only a little. The
SequenceMatcher.ratio() for these strings 0.0. Many other similar
strings are working fine without problems (see below) with non-zero
ratios depending on how much difference there is between strings (as
expected).

Tested on Python 2.7 on Ubuntu 14.04

Program follows:
---
from difflib import SequenceMatcher as SM

src = u"N KPT T HS KMNST KNFKXNS AS H KLT FR 0 ALMNXN AF PRFT PRPRT AN
RRL ARS T P RPLST P KMNS H ASTPLXT HS ANTSTRL KR0 PRKRM NN AS 0 KRT LP
FRRT 0S PRKRM KLT FR 0 RPT TRNSFRMXN AF XN FRM AN AKRRN AKNM T A SSLST
ANTSTRL SST"
trg = u"M KPT T HS KMNST KNFKXNS AS H KLT FR 0 ALMNXN AF PRFT PRPRT AN
RRL ARS T P RPLST P KMNS H ASTPLXT HS ANTSTRL KR0 PRKRM NN AS 0 KRT LP
FRRT 0S PRKRM KLT FR 0 RPT TRNSFRMXN AF XN FRM AN AKRRN AKNM T SSLST
ANTSTRL SST"
print src, '\n', trg, '\n', SM(None, trg, src).ratio()
---


The following sequence prints a ratio() of 0.989795918367 which seems
about right.
---
src = u"M STNK AS AN AF 0 MST AMPRTNT LTRS TRNK 0 TNT0 SNTR HS MST
PRMNNT AKMPLXMNT AS 0 ASTPLXMNT AF 0 PPLS RPPLK AF XN HS A0R AXFMNTS
ANKLTT LTNK HS PPL AN 0 LNK MRX AFR FR 0SNT MLS T KP 0 KMNST MFMNT
ALF"
trg = u"M STNK AS AN AF 0 MST AMPRTNT LTRS TRNK 0 0 SNTR HS MST PRMNNT
AKMPLXMNT AS 0 ASTPLXMNT AF 0 PPLS RPPLK AF XN HS A0R AXFMNTS ANKLT
LTNK HS PPL AN 0 LNK MRX AFR FR 0SNT MLS T KP 0 KMNST MFMNT ALF"
print src, '\n', trg, '\n', SM(None, trg, src).ratio()
---

What could be the cause? Is there something I am doing wrong?

Thanks in advance
-- 
Regards
Jay
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with difflib SequenceMatcher

2016-09-12 Thread Alain Ketterlin
Jay  writes:

> I am having an odd problem with difflib.SequenceMatcher. Sample code below:
>
> The strings "src" and "trg" differ only a little.

How exactly? (Please be precise, it helps testing.)

> The SequenceMatcher.ratio() for these strings 0.0. Many other similar
> strings are working fine without problems (see below) with non-zero
> ratios depending on how much difference there is between strings (as
> expected).

Calling SM(...,trg[1:],src[1:]) gives plausible result. See also the
result of .get_matching_blocks() on your strings (it returns no matching
blocks).

It is all due to the "Autojunk" heuristics (see difflib's doc for
details), which considers the first characters as junk. Call
SM(...,autojunk=False).

I have no idea why the maintainers made this stupid autojunk idea the
default. Complain with them.

-- Alain.

> Tested on Python 2.7 on Ubuntu 14.04
>
> Program follows:
> ---
> from difflib import SequenceMatcher as SM
>
> src = u"N KPT T HS KMNST KNFKXNS AS H KLT FR 0 ALMNXN AF PRFT PRPRT AN
> RRL ARS T P RPLST P KMNS H ASTPLXT HS ANTSTRL KR0 PRKRM NN AS 0 KRT LP
> FRRT 0S PRKRM KLT FR 0 RPT TRNSFRMXN AF XN FRM AN AKRRN AKNM T A SSLST
> ANTSTRL SST"
> trg = u"M KPT T HS KMNST KNFKXNS AS H KLT FR 0 ALMNXN AF PRFT PRPRT AN
> RRL ARS T P RPLST P KMNS H ASTPLXT HS ANTSTRL KR0 PRKRM NN AS 0 KRT LP
> FRRT 0S PRKRM KLT FR 0 RPT TRNSFRMXN AF XN FRM AN AKRRN AKNM T SSLST
> ANTSTRL SST"
> print src, '\n', trg, '\n', SM(None, trg, src).ratio()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread jmp

On 09/12/2016 03:11 AM, Chris Angelico wrote:

On Mon, Sep 12, 2016 at 6:30 AM, Sven R. Kunze  wrote:


I could not agree more with what you said above, so I hope this will put the
discussion in better perspective, especially when people here trying to be
overly absolute in their views (which was the quote about).



Strange that you think I'm a more moderate position. I have some
_extremely_ strong views about absolutes (they come from the Creator
of the Universe), and it's not just abstract concepts like numbers
that have absolutes. There are hard-and-fast facts about the world,
and even about human nature, that stem from the way we were made.

However, lengthy discussion of such things is WAY off topic here.

ChrisA



Let me help you phrase on-topic nonsense:

I strongly believe that God is within each "self" parameter of each 
method ever written since 1989 aka 0 BGvR :o)


jm

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


memberof example using ldap

2016-09-12 Thread Robert Clove
Hi,
I have to find if user is the member of a group, for this i am using the
following query

(&(objectClass=user)(sAMAccountName=yourUserName)
  (memberof=CN=YourGroup,OU=Users,DC=YourDomain,DC=com))

  (memberof=CN=YourGroup,OU=Users,DC=YourDomain,DC=com)== values from
distinguished name of your group

The above query doesn't work fine even if group doesn't exist,

It always says that user is member of
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread Marko Rauhamaa
"Eric S. Johansson" :

> On 9/11/2016 10:26 PM, Chris Angelico wrote:
>> No, God isn't part of the universe, any more than an author is part
>> of his novel.
>>
> as any fiction writer will tell you, the author is found in one or
> more of their characters.

God created us in his image. IOW, God is a Python hacker, and we are
instances of some Python classes running on a cosmic VM.
https://en.wikipedia.org/wiki/Simulation_hypothesis>

The Book suggests God had some initial interaction with his creation but
quickly grew frustrated and ultimately bored. He must have found other
interests (or friends) long time ago, but has apparently forgotten the
server running in a corner closet. It has been prophesied that God will
eventually write a Version 2 of the universe which will have most of the
known glitches in Version 1 fixed. Mandatory upgrades will be pushed
from the Cloud.

Personally, I suspect Version 2 is all vaporware.


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


Re: How to split value where is comma ?

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 12:00 AM, jmp  wrote:
> On 09/11/2016 02:12 PM, Chris Angelico wrote:
>>
>> On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola
>>  wrote:

 I have worked places where they put stuff like this at the bottom of
 emails sent to the person sitting next to them :) -raising entropy-ly yrs-
 Robin Becker
>>>
>>>
>>> Cannot do anything about it. It is not on my MTA client and it is added
>>> by the company server :(
>
>
> [snip]
>
>> Tell your bosses how stupid it makes the company look.
>>
>> ChrisA
>>
>
> That could get someone into troubles. I would not follow that advice before
> considering the probable outcomes.

Yes. Consider the probable outcomes before doing it, but still do it.
If you're more important to the company than the stupid-looking
boiler-plate, it will be fired rather than you. And if you learn that
pseudo-legalese boiler-plate is more important than you are... you
probably don't want to work there anyway.

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


Re: How to split value where is comma ?

2016-09-12 Thread jmp

On 09/11/2016 02:12 PM, Chris Angelico wrote:

On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola
 wrote:

I have worked places where they put stuff like this at the bottom of emails 
sent to the person sitting next to them :) -raising entropy-ly yrs- Robin Becker


Cannot do anything about it. It is not on my MTA client and it is added by the 
company server :(


[snip]


Tell your bosses how stupid it makes the company look.

ChrisA



That could get someone into troubles. I would not follow that advice 
before considering the probable outcomes.


I'd rather go for the change of mail server.

jm

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


Re: How to split value where is comma ?

2016-09-12 Thread Grant Edwards
On 2016-09-12, jmp  wrote:
> On 09/11/2016 02:12 PM, Chris Angelico wrote:
>> On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola
>>  wrote:
 I have worked places where they put stuff like this at the bottom of 
 emails sent to the person sitting next to them :) -raising entropy-ly yrs- 
 Robin Becker
>>>
>>> Cannot do anything about it. It is not on my MTA client and it is added by 
>>> the company server :(
>
> [snip]
>
>> Tell your bosses how stupid it makes the company look.
>>
>> ChrisA
>>
>
> That could get someone into troubles.

Well, you need to be a bit diplomatic about it:

  "Just FYI, people have told me that they think our boilerplate
   disclaimer makes it seem that the company is naive and lacks an
   understanding of how the Internet works and the legalities
   involved..."

-- 
Grant Edwards   grant.b.edwardsYow! Is something VIOLENT
  at   going to happen to a
  gmail.comGARBAGE CAN?

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


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread alister
On Mon, 12 Sep 2016 16:12:02 +0300, Marko Rauhamaa wrote:

> "Eric S. Johansson" :
> 
>> On 9/11/2016 10:26 PM, Chris Angelico wrote:
>>> No, God isn't part of the universe, any more than an author is part of
>>> his novel.
>>>
>> as any fiction writer will tell you, the author is found in one or more
>> of their characters.
> 
> God created us in his image. IOW, God is a Python hacker, and we are
> instances of some Python classes running on a cosmic VM.
> https://en.wikipedia.org/wiki/Simulation_hypothesis>
> 
> The Book suggests God had some initial interaction with his creation but
> quickly grew frustrated and ultimately bored. He must have found other
> interests (or friends) long time ago, but has apparently forgotten the
> server running in a corner closet. It has been prophesied that God will
> eventually write a Version 2 of the universe which will have most of the
> known glitches in Version 1 fixed. Mandatory upgrades will be pushed
> from the Cloud.
> 
> Personally, I suspect Version 2 is all vaporware.
> 
> 
> Marko

perhaps "The Matrix" had it right
we could not cope wit a perfect world so this is in fact V2 & the 
glitches are deliberate



-- 
Twenty Percent of Zero is Better than Nothing.
-- Walt Kelly
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to split value where is comma ?

2016-09-12 Thread alister
On Mon, 12 Sep 2016 14:30:32 +, Grant Edwards wrote:

> On 2016-09-12, jmp  wrote:
>> On 09/11/2016 02:12 PM, Chris Angelico wrote:
>>> On Thu, Sep 8, 2016 at 7:27 PM, Joaquin Alzola
>>>  wrote:
> I have worked places where they put stuff like this at the bottom of
> emails sent to the person sitting next to them :) -raising
> entropy-ly yrs- Robin Becker

 Cannot do anything about it. It is not on my MTA client and it is
 added by the company server :(
>>
>> [snip]
>>
>>> Tell your bosses how stupid it makes the company look.
>>>
>>> ChrisA
>>>
>>>
>> That could get someone into troubles.
> 
> Well, you need to be a bit diplomatic about it:
> 
>   "Just FYI, people have told me that they think our boilerplate
>disclaimer makes it seem that the company is naive and lacks an
>understanding of how the Internet works and the legalities
>involved..."

Tag on

"and they are not sure the want to do business with us because of it"

that should make someone look at it first rather than simply dismiss it 
out of hand



-- 
Real Users are afraid they'll break the machine -- but they're never
afraid to break your face.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: memberof example using ldap

2016-09-12 Thread John Gordon
In  Robert Clove 
 writes:

> Hi,
> I have to find if user is the member of a group, for this i am using the
> following query

> (&(objectClass=user)(sAMAccountName=yourUserName)
>   (memberof=CN=YourGroup,OU=Users,DC=YourDomain,DC=com))

> The above query doesn't work fine even if group doesn't exist,

> It always says that user is member of

The query returns a user who is not a member of the named group?
That's odd.

What is the search base and scope?

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


Re: Mysterious Logging Handlers

2016-09-12 Thread Josh English
On Friday, September 9, 2016 at 11:29:32 AM UTC-7, John Gordon wrote:
> In <247db0ab-efe7-484b-a418-dd219f68a...@googlegroups.com> Josh English 
>  writes:
> 
> > When I run the scriptI get logging information from only xlreader, not
> > from the main script:
> 
> > DEBUG:XLREADER:Creating Excel Reader
> 
> > This format isn't defined anywhere.
> 
> That is the default logging format; it's used when you haven't supplied any
> format of your own.  The snippet of xlreader.py does not define any format,
> so it seems like that's where it's coming from.
> 
> (This seems pretty straightforward; am I missing something?)
> 

Strange. I don't see that in the docs anywhere. I figure if basicConfig can set 
the level, it can set the formatting, too, for all my loggers, not just one.

I suspect my IDE was interfering somehow. I'm using Sypder with WinPython 
Portable and when I changed my run settings to run in a new dedicated console, 
logging worked an expected.

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


Re: Mysterious Logging Handlers

2016-09-12 Thread Josh English
On Friday, September 9, 2016 at 11:31:13 AM UTC-7, Peter Otten wrote:
> Josh English wrote:
> 
> > 
> > LOG = logging.getLogger('SHIPPING')
> > FORMAT = '%(asctime)-15s %(name)s %(level)-8s %(message)s'
> 
> That should be either levelname or levelno in the format string.

Yeah, I caught that after I tried running the script in a dedicated console in 
Spyder, and my logging worked as expected. I got the format and whole bunch of 
errors about this.


> > 
> > Even more mysterious, after I run the file (in an IDE so I have a REPL
> > afterwards), I have:
> 
> Don't run your code in an IDE. The interaction between your and their code 
> can make debugging harder than necessary.

I suspect the IDE was the problem, because the dedicated console option solved 
the problem.

Thanks,

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


KeyError: 'handlers.RotatingFileHandler'

2016-09-12 Thread Daiyue Weng
Hi, I am trying to use 'RotatingFileHandler' in a logging config file,

import logging
import logging.config
import logging.handlers

logging.config.fileConfig('logging.conf')


[loggers]
keys=root,ingestion_log

[handlers]
keys=consoleHandler,fileHandler

[formatters]
keys=ingestFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler

[logger_ingestion_log]
level=DEBUG
handlers=handlers.RotatingFileHandler
maxBytes=51200
qualname=ingestion_log
propagate=0

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=Formatter
args=(sys.stdout,)

[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=Formatter
args=("log/logging.log",)

[formatter_Formatter]
format=pathname~%(pathname)s||timestamp~%(asctime)s||level~%(levelname)s||name~%(name)s||function_name~%(funcName)s||debug_message~%(message)s
datefmt=%m/%d/%Y %H:%M:%S


but Python generated a key error,

C:\Continuum\Anaconda3\lib\logging\config.py:85: in fileConfig
_install_loggers(cp, handlers, disable_existing_loggers)
C:\Continuum\Anaconda3\lib\logging\config.py:254: in _install_loggers
logger.addHandler(handlers[hand])
E   KeyError: 'handlers.RotatingFileHandler'

how to fix the errors?

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


Re: Mysterious Logging Handlers

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 2:12 AM, Josh English
 wrote:
>> > Even more mysterious, after I run the file (in an IDE so I have a REPL
>> > afterwards), I have:
>>
>> Don't run your code in an IDE. The interaction between your and their code
>> can make debugging harder than necessary.
>
> I suspect the IDE was the problem, because the dedicated console option 
> solved the problem.

IDEs can be really helpful, but they do introduce extra variables.
Whenever you have a problem, save your code to a stand-alone script
(if it isn't already one), and run it independently of the IDE. You
should be able to just pull up a terminal on your system and run
"python3 scriptname.py" to see it run in a clean(er) envirnonment.

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


Re: KeyError: 'handlers.RotatingFileHandler'

2016-09-12 Thread Peter Otten
Daiyue Weng wrote:

> Hi, I am trying to use 'RotatingFileHandler' in a logging config file,
> 
> import logging
> import logging.config
> import logging.handlers
> 
> logging.config.fileConfig('logging.conf')
> 
> 
> [loggers]
> keys=root,ingestion_log
> 
> [handlers]
> keys=consoleHandler,fileHandler
> 
> [formatters]
> keys=ingestFormatter
> 
> [logger_root]
> level=DEBUG
> handlers=consoleHandler
> 
> [logger_ingestion_log]
> level=DEBUG
> handlers=handlers.RotatingFileHandler

The handlers listed above must be taken from the keys value in the 
[handlers] section. If you want a third logger you have to add a 
corresponding key there first under a name that you invented, e. g.

[handlers]
keys=consoleHandler,fileHandler,my_rotating_filehandler

You also need a

[handler_my_rotating_handler]

section where you specify the class etc. Only then you can reference it in 
the logger section as

[logger_ingestion_log]
handlers=my_rotating_filehandler

For the details have another look at

https://docs.python.org/dev/library/logging.config.html#logging-config-fileformat

> maxBytes=51200
> qualname=ingestion_log
> propagate=0
> 
> [handler_consoleHandler]
> class=StreamHandler
> level=DEBUG
> formatter=Formatter
> args=(sys.stdout,)
> 
> [handler_fileHandler]
> class=FileHandler
> level=DEBUG
> formatter=Formatter
> args=("log/logging.log",)
> 
> [formatter_Formatter]
> format=pathname~%(pathname)s||timestamp~%(asctime)s||level~%(levelname)s||
name~%(name)s||function_name~%(funcName)s||debug_message~%(message)s
> datefmt=%m/%d/%Y %H:%M:%S
> 
> 
> but Python generated a key error,
> 
> C:\Continuum\Anaconda3\lib\logging\config.py:85: in fileConfig
> _install_loggers(cp, handlers, disable_existing_loggers)
> C:\Continuum\Anaconda3\lib\logging\config.py:254: in _install_loggers
> logger.addHandler(handlers[hand])
> E   KeyError: 'handlers.RotatingFileHandler'
> 
> how to fix the errors?
> 
> thanks


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


Re: Software Needs Philosophers

2016-09-12 Thread danutzp0
Yes, it does:

https://philosoftware.wordpress.com/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: collect2: ld returned 1 exit status when building from source

2016-09-12 Thread BartC

On 12/09/2016 07:59, dieter wrote:

Steve D'Aprano  writes:

...
but the build still fails, with the same errors:


Python/dtrace_stubs.o: In function `PyDTrace_LINE':
/home/steve/python/python-dev/cpython/Include/pydtrace.h:25: multiple
definition of `PyDTrace_LINE'
Python/ceval.o:/home/steve/python/python-dev/cpython/Include/pydtrace.h:25:
first defined here
  [ ... many, many, many more similar errors ... ]

collect2: ld returned 1 exit status
make: *** [Programs/_freeze_importlib] Error 1


Looks as if some error has slipped in the sources: you should not have multiple
conflicting definitions for the same symbol (e.g. "PyDTrace_LINE").
Alternatively, your built might fetch wrong headers (e.g. headers
for a different Python version).

I would look at the places from which the "multiple definition"s come
and try to find out why there are multiple of them.


I downloaded the sources to have a look, but I couldn't even see those 
files (only ceval.c). Perhaps they are auto-generated as part of the build.


I hate these complicated auto-build-tools where they /have/ to work 100% 
perfectly otherwise you're ... in deep trouble when something goes 
wrong. And this is a perfect example.


--
bartc



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


Re: Software Needs Philosophers

2016-09-12 Thread Andrea D'Amore

On 2016-09-12 17:09:03 +, danut...@gmail.com said:


Yes, it does:


Operating systems do as well 
.



--
Andrea

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


Re: How to extend a tuple of tuples?

2016-09-12 Thread John Gordon
In <2349538.mvxudi8...@pointedears.de> Thomas 'PointedEars' Lahn 
 writes:

> >> The obvious way does not work -
> >>
> >> a += (5, 6)
>  ^^
> > Right, because a tuple is immutable.

> How did you get that idea?  It has been mutated in the very statement that 
> you are quoting

No.  An entirely new tuple is created, and 'a' is rebound to it.  The
existing tuple is not mutated.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


Re: How to extend a tuple of tuples?

2016-09-12 Thread BartC

On 12/09/2016 21:31, Thomas 'PointedEars' Lahn wrote:

Ben Finney wrote:


"Frank Millman"  writes:

Assume you have a tuple of tuples -

a = ((1, 2), (3, 4))

You want to add a new tuple to it, so that it becomes


As you acknowledge, the tuple ‘a’ can't become anything else. Instead,
you need to create a different value.


Wrong.


The obvious way does not work -

a += (5, 6)

   ((1, 2), (3, 4), 5, 6)

 ^^

Right, because a tuple is immutable.


How did you get that idea?  It has been mutated in the very statement that
you are quoting,


By the same argument, then strings and ints are also mutable.

Here, the original tuple that a refers to has been /replaced/ by a new 
one. The original is unchanged. (Unless, by some optimisation that 
recognises that there are no other references to it, the original is 
actually appended to. But in general, new objects are constructed when 
implementing +=.)


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


Re: How to extend a tuple of tuples?

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 7:19 AM, BartC  wrote:
> By the same argument, then strings and ints are also mutable.
>
> Here, the original tuple that a refers to has been /replaced/ by a new one.
> The original is unchanged. (Unless, by some optimisation that recognises
> that there are no other references to it, the original is actually appended
> to. But in general, new objects are constructed when implementing +=.)

And by definition, that optimization cannot be detected. At best, all
you could do is something like:

old_id = id(a)
a += something
if id(a) == old_id:
print("We may have an optimization, folks!")

But that can have false positives. If two objects do not concurrently
exist, they're allowed to have the same ID number.

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


Re: Expression can be simplified on list

2016-09-12 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote:

> On Mon, Sep 12, 2016 at 9:14 PM, Daiyue Weng  wrote:
>> Hi, I found that when I tried to make an equality test on empty like,
>>
>> if errors == []:
>>
>> PyCharm always warns me,
>>
>> Expression can be simplified.
>>
>> I am wondering what's wrong and how to fix this?
>>
> 
> If you know that 'errors' is always going to be a list, you can check
> for emptiness thus:
> 
> if not errors:

If I knew that it is always going to be a list or a tuple, I would check its 
length instead:

  if len(errors) == 0:

Only if I did not know that I would use the “not” keyword, because the 
latter

  a) forces a type conversion to “bool”;
  b) also works with values of other types.
 
> PyCharm recommends this syntax rather than the comparison with a
 ^^^
> newly-created empty list.

Are you sure?

> Your code has to actually construct and dispose of a list, just for the
> comparison.

ACK

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Expression can be simplified on list

2016-09-12 Thread Chris Angelico
On Tue, Sep 13, 2016 at 7:21 AM, Thomas 'PointedEars' Lahn
 wrote:
> If I knew that it is always going to be a list or a tuple, I would check its
> length instead:
>
>   if len(errors) == 0:

I wouldn't. I'd use boolification here too. Only if I had to
distinguish between None, [], and [1,2,3], would I use a more explicit
check (and it wouldn't be "== []", it would be probing for None).

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


Re: mssql date format

2016-09-12 Thread sum abiut
Thanks for the response,
i pulling data from an mssql database and i need to convert the date
column. how to i covert and pass it to my template. i am using Django

this is what i did

conn=pymssql.connect(server,username,password,database)
#cus=conn.cursor()
cus=conn.cursor(as_dict=True)
cus.execute("SELECT
account_code,currency_code,balance_date,debit,credit,net_change,home_net_change
FROM glbal where account_code= '50101001CORP'")

return render_to_response('revenue_budget.html',locals())


how to i  convert the balance_date with the code below:



import datetime
>>> datetime.datetime.fromordinal(733010)
>>>
>> datetime.datetime(2007, 11, 30, 0, 0)



On Mon, Sep 12, 2016 at 12:15 PM, MRAB  wrote:

> On 2016-09-12 01:37, sum abiut wrote:
>
>> Hi,
>> I am pulling data from an mssql server database and got a date in this
>> format: 733010
>> please advise what of date is this and how to i convert it to a readable
>> date?
>>
>> i use pyssql to connect to the database and pull data fro the database.
>>
>> Does the date "30 November 2007" look reasonable for that data?
>
> If it does, it's a """proleptic Gregorian ordinal, where January 1 of year
> 1 has ordinal 1""" (from the docs):
>
> import datetime
 datetime.datetime.fromordinal(733010)

>>> datetime.datetime(2007, 11, 30, 0, 0)
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.6.0b1 is now available

2016-09-12 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release
team, I'm happy to announce the availability of Python 3.6.0b1. 3.6.0b1
is the first of four planned beta releases of Python 3.6, the next major
release of Python, and marks the end of the feature development phase
for 3.6.

Among the new major new features in Python 3.6 are:

* PEP 468 - Preserving the order of **kwargs in a function
* PEP 487 - Simpler customization of class creation
* PEP 495 - Local Time Disambiguation
* PEP 498 - Literal String Formatting
* PEP 506 - Adding A Secrets Module To The Standard Library
* PEP 509 - Add a private version to dict
* PEP 515 - Underscores in Numeric Literals
* PEP 519 - Adding a file system path protocol
* PEP 520 - Preserving Class Attribute Definition Order
* PEP 523 - Adding a frame evaluation API to CPython
* PEP 524 - Make os.urandom() blocking on Linux (during system startup)
* PEP 525 - Asynchronous Generators (provisional)
* PEP 526 - Syntax for Variable Annotations (provisional)
* PEP 528 - Change Windows console encoding to UTF-8 (provisional)
* PEP 529 - Change Windows filesystem encoding to UTF-8 (provisional)
* PEP 530 - Asynchronous Comprehensions

Please see "What’s New In Python 3.6" for more information:

https://docs.python.org/3.6/whatsnew/3.6.html

You can find Python 3.6.0b1 here:

https://www.python.org/downloads/release/python-360b1/

Beta releases are intended to give the wider community the opportunity
to test new features and bug fixes and to prepare their projects to
support the new feature release. We strongly encourage maintainers of
third-party Python projects to test with 3.6 during the beta phase and
report issues found to bugs.python.org as soon as possible. While the
release is feature complete entering the beta phase, it is possible that
features may be modified or, in rare cases, deleted up until the start
of the release candidate phase (2016-12-05). Our goal is have no changes
after rc1. To achieve that, it will be extremely important to get as
much exposure for 3.6 as possible during the beta phase. Please keep in
mind that this is a preview release and its use is not recommended for
production environments

The next planned release of Python 3.6 will be 3.6.0b2, currently
scheduled for 2016-10-03. More information about the release schedule
can be found here:

https://www.python.org/dev/peps/pep-0494/

--
  Ned Deily
  n...@python.org -- []

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


Re: mssql date format

2016-09-12 Thread MRAB

On 2016-09-13 00:06, sum abiut wrote:

Thanks for the response,
i pulling data from an mssql database and i need to convert the date 
column. how to i covert and pass it to my template. i am using Django


this is what i did

conn=pymssql.connect(server,username,password,database)
#cus=conn.cursor()
cus=conn.cursor(as_dict=True)
cus.execute("SELECT 
account_code,currency_code,balance_date,debit,credit,net_change,home_net_change 
FROM glbal where account_code= '50101001CORP'")


return render_to_response('revenue_budget.html',locals())


how to i  convert the balance_date with the code below:



import datetime
datetime.datetime.fromordinal(733010)

datetime.datetime(2007, 11, 30, 0, 0)


The documentation for pymssql should tell you how to get the values of 
the fields.


In the case of the 'balance_date' field, just pass its value into 
datetime.datetime.fromordinal like the code I gave.

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


How to fix PyV8 linux setup error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

2016-09-12 Thread p . infante413
Hello, I am currently installing Pyv8 and other requirements for me to run a 
honeypot. I downloaded pyv8 from source and using v8 (version 5.5) - built it 
with depot_tools. I already exported the V8_HOME path. But I still have this 
error whenever I run 'python setup.py build' of pyv8. Also, I am using Python 
2.7. Here is the output I get:

running build
running build_py
running build_ext
building '_PyV8' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g 
-fstack-protector-strong -Wformat -Werror=format-security -fPIC 
-DBOOST_PYTHON_STATIC_LIB -DV8_NATIVE_REGEXP -DENABLE_DISASSEMBLER 
-DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -DV8_TARGET_ARCH_X64 
-I/home/patricia/Thesis/v8/include -I/home/patricia/Thesis/v8 
-I/home/patricia/Thesis/v8/src -I/usr/include/python2.7 -c src/Exception.cpp -o 
build/temp.linux-x86_64-2.7/src/Exception.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC 
but not for C++
In file included from /usr/include/c++/5/unordered_set:35:0,
 from /home/patricia/Thesis/v8/src/heap/spaces.h:10,
 from /home/patricia/Thesis/v8/src/heap/mark-compact.h:12,
 from /home/patricia/Thesis/v8/src/heap/incremental-marking.h:12,
 from /home/patricia/Thesis/v8/src/heap/incremental-marking-inl.h:8,
 from /home/patricia/Thesis/v8/src/heap/heap-inl.h:13,
 from /home/patricia/Thesis/v8/src/objects-inl.h:24,
 from /home/patricia/Thesis/v8/src/arguments.h:9,
 from /home/patricia/Thesis/v8/src/debug/debug.h:9,
 from /usr/include/c++/5/bits/stl_iterator_base_funcs.h:65,
 from /usr/include/c++/5/bits/stl_algobase.h:66,
 from /usr/include/c++/5/bits/char_traits.h:39,
 from /usr/include/c++/5/string:40,
 from /usr/include/c++/5/stdexcept:39,
 from src/Exception.h:4,
 from src/Exception.cpp:1:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires 
compiler and library support for the ISO C++ 2011 standard. This support must 
be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
 ^
src/Exception.cpp:18:25: fatal error: src/natives.h: No such file or directory
#include "src/natives.h"
 ^

compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Well, before that, it repeatedly asks for exporting V8 to V8_HOME and building 
it. I do it repeatedly just to move on from it, and now, I get this. Also, I 
already searched in Ubuntu Packages Content Search (http://tiny.cc/snyrey) 
about /usr/include/c++/5/bits/stl_iterator_base_funcs.h, .../stl_algobase.h, 
.../char_traits.h, etc. That all led me to installing libstdc++-5-dev via 
apt-get install libstdc++-5-dev

But still. I am getting the error. Any help will be appreciated. :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Julian date to calendar date conversion

2016-09-12 Thread sum abiut
Hi,
how to convert julian date to a calander date

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


Re: Julian date to calendar date conversion

2016-09-12 Thread MRAB

On 2016-09-13 02:12, sum abiut wrote:

Hi,
how to convert julian date to a calander date


Have a look at the jdcal module on PyPI:

https://pypi.python.org/pypi/jdcal

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


Re: Julian date to calendar date conversion

2016-09-12 Thread sum abiut
Thanks

On Tue, Sep 13, 2016 at 12:37 PM, MRAB  wrote:

> On 2016-09-13 02:12, sum abiut wrote:
>
>> Hi,
>> how to convert julian date to a calander date
>>
>> Have a look at the jdcal module on PyPI:
>
> https://pypi.python.org/pypi/jdcal
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: mssql date format

2016-09-12 Thread Nathan Ernst
Note that this issue is mentioned in the pymssql FAQ:
http://pymssql.org/en/stable/faq.html#pymssql-does-not-unserialize-date-and-time-columns-to-datetime-date-and-datetime-time-instances

Regards,
Nathan

On Mon, Sep 12, 2016 at 8:29 PM, Dennis Lee Bieber 
wrote:

> On Tue, 13 Sep 2016 00:52:59 +0100, MRAB 
> declaimed the following:
>
> >On 2016-09-13 00:06, sum abiut wrote:
> >> Thanks for the response,
> >> i pulling data from an mssql database and i need to convert the date
> >> column. how to i covert and pass it to my template. i am using Django
> >>
> >> this is what i did
> >>
> >> conn=pymssql.connect(server,username,password,database)
> >> #cus=conn.cursor()
> >> cus=conn.cursor(as_dict=True)
> >> cus.execute("SELECT
> >> account_code,currency_code,balance_date,debit,credit,net_
> change,home_net_change
> >> FROM glbal where account_code= '50101001CORP'")
> >>
> >> return render_to_response('revenue_budget.html',locals())
> >>
> >>
> >> how to i  convert the balance_date with the code below:
> >>
> >>
> >>
> >> import datetime
> >> datetime.datetime.fromordinal(733010)
> >>
> >> datetime.datetime(2007, 11, 30, 0, 0)
> >>
> >>
> >The documentation for pymssql should tell you how to get the values of
> >the fields.
> >
> >In the case of the 'balance_date' field, just pass its value into
> >datetime.datetime.fromordinal like the code I gave.
>
> I have a suspicion the OP needs more basic help than that -- like
> how
> to take data from the database, modify it, and pass it on to Django for
> rendering. Note that the sample code never references records from the
> cursor, and seems to just dump [locals()] everthing into the response
> template.
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Expression can be simplified on list

2016-09-12 Thread Ned Batchelder
On Monday, September 12, 2016 at 5:21:51 PM UTC-4, Thomas 'PointedEars' Lahn 
wrote:
> Chris Angelico wrote:
> 
> > On Mon, Sep 12, 2016 at 9:14 PM, Daiyue Weng  wrote:
> > If you know that 'errors' is always going to be a list, you can check
> > for emptiness thus:
> > 
> > if not errors:
> 
> If I knew that it is always going to be a list or a tuple, I would check its 
> length instead:
> 
>   if len(errors) == 0:
> 
> Only if I did not know that I would use the “not” keyword, because the 
> latter
> 
>   a) forces a type conversion to “bool”;
>   b) also works with values of other types.

Why do you object to the type conversion to bool?

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


Re: How to extend a tuple of tuples?

2016-09-12 Thread Ned Batchelder
On Monday, September 12, 2016 at 4:31:37 PM UTC-4, Thomas 'PointedEars' Lahn 
wrote:
> Ben Finney wrote:
> > So instead, you want a different tuple. You do that by creating it,
> > explicitly constructing a new sequence with the items you want::
> > 
> > b = tuple([
> > item for item in a
> > ] + [(5, 6)])
> 
> The correct approach is
> 
> | >>> a += (5, 6),
> | >>> a
> | ((1, 2), (3, 4), (5, 6))
> 
> The problem here is an ambiguity in the Python grammar where “(5, 6)” is 
> _not_ parsed as a double, but as a list of singles.  The ambiguity is 
> resolved by adding a trailing comma.  

There is no ambiguity in "(5, 6)". It is a tuple of two ints.  To make
a sequence of tuples (albeit a one-element sequence), you add a comma
to make it a one-element tuple, which is the same as "((5,6),)".

> (This is basic Python knowledge.)

Considering the gaps in your own Python knowledge, please try not
to be condescending when answering questions here.

For a discussion of mutability and immutability in Python, which will
help with the other part of the discussion, you might like:

http://nedbatchelder.com/text/names1.html

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


Re: [Python-ideas] Inconsistencies

2016-09-12 Thread Rustom Mody
On Monday, September 12, 2016 at 4:42:39 PM UTC+5:30, Eric S. Johansson wrote:
> On 9/11/2016 10:26 PM, Chris Angelico wrote:
> > No, God isn't part of the universe, any more than an author is part of
> > his novel.
> >
> as any fiction writer will tell you, the author is found in one or more
> of their characters.

Heh! An intelligent observation!
And in the same vein, a non-messianic interpretation of the core Christian 
teaching:
http://themindunleashed.org/2015/11/you-are-god-the-true-teachings-of-jesus.html
-- 
https://mail.python.org/mailman/listinfo/python-list