Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Steve D'Aprano
On Sat, 20 May 2017 11:42 am, Gregory Ewing wrote:

> Steve D'Aprano wrote:
>> On Fri, 19 May 2017 11:35 pm, Edward Ned Harvey (python) wrote:
>> 
>>> I *thought* python 3.0 to 3.4 would *ignore* annotations, but it
>>> doesn't...
>> 
>> Why would you think that?
> 
> Ever since Guido retconned the purpose of annotations to be
> for static type hinting *only*, it would make more sense for
> the interpreter to ignore them, or at least not evaluate them
> immediately at run time (since it would avoid all the problems
> of forward references, etc).

You mean treat them as syntactically comments?

def function(arg:I can put ***ANYTHING*** I like here!!!):
...

I don't think that's a good idea.

Ever since they were introduced, annotations have always been evaluated and
recorded in the function.__annotations__ attribute. That makes them
available at runtime for decorator to do additional processing, or for
introspection.


> So I can see how someone relying on the principle of least
> surprise might assume that.

Oh I don't know, given that everything else apart from #comments is
evaluated at runtime[1] in Python, I think it would be surprising if
annotations weren't.




[1] Apart from some constant folding done as an optimization.


-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Steve D'Aprano
On Sat, 20 May 2017 11:57 am, Chris Angelico wrote:

> They're function metadata. What would the principle of least surprise
> say about this?
> 
> print("Spam")
> def func(arg: print("Foo") = print("Quux")):
> print("Blargh")
> print("Fred")
> func()
> print("Eggs")
> 
> What should be printed, and in what order?

My prediction:

Spam
Foo
Quux
Fred
Blargh
Eggs

but I wouldn't be the least bit astonished if Foo and Quux are in the
opposite order. As in fact they are.

> Actually, Python does violate least-surprise in one area here. There's
> one message that gets printed "out of order" compared to my
> expectation. I wonder if it's the same one that other people will be
> surprised at.


The reason appears to be that the default arguments are evaluated first,
from left to right, followed by the annotations:


py> def func(a:print(1)=print(2), b:print(3)=print(4), c:print(4)=print(5)):
... pass
...
2
4
5
1
3
4




-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


Re: Finding sentinel text when using a thread pool...

2017-05-20 Thread dieter
Christopher Reimer  writes:
> I'm developing a web scraper script. It takes 25 minutes to process
> 590 pages and ~9,000 comments. I've been told that the script is
> taking too long.
>
> The way the script currently works is that the page requester is a
> generator function that requests a page, checks if the page contains
> the sentinel text (i.e., "Sorry, no more comments."), and either
> yields the page and request the next page or exits the function. Every
> yielded page is parsed by Beautiful Soup and saved to disk.
>
> Timing the page requester separately from the rest of the script and
> the end value set to 590, each page request takes 1.5 seconds.

That's very slow to fetch a page.

> If I use a thread pool of 16 threads, each request takes 0.1
> seconds. (Higher thread numbers will result in the server forcibly
> closing the connection.)
>
> I'm trying to figure out how I would find the sentinel text by using a
> thread pool. Seems like I need to request an arbitrary number of pages
> (perhaps one page per thread), evaluate the contents of each page for
> the sentinel text, and either request another set of pages or exit the
> function.

If your (590) pages are linked together (such that you must fetch
a page to get the following one) and page fetching is the limiting
factor, then this would limit the parallelizability.

If processing a selected page takes a significant amount of time
(compared to the fetching), then you could use a work queue as follows:
a page is fetched and the following page determined; if a following
page is found, processing this page is put as a job into the work queue
and page processing is continued. Free tasks look for jobs in the work queue
and process them.

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


Re: I need help with making my claculator

2017-05-20 Thread bartc

On 20/05/2017 03:10, Chris Angelico wrote:

On Sat, May 20, 2017 at 11:40 AM,   wrote:

def calc(self, display):
try:
display.set(eval(display.get()))
except:
display.set("Type an actual equation please!")


Without any specific questions, you're not going to get anything more
than a basic eyeballing of the code.


Try running the program.

(I did that but I can't follow this style of coding so can't help.)

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


Re: I need help with making my claculator

2017-05-20 Thread Chris Angelico
On Sat, May 20, 2017 at 9:13 PM, bartc  wrote:
> On 20/05/2017 03:10, Chris Angelico wrote:
>>
>> On Sat, May 20, 2017 at 11:40 AM,   wrote:
>>>
>>> def calc(self, display):
>>> try:
>>> display.set(eval(display.get()))
>>> except:
>>> display.set("Type an actual equation please!")
>>
>>
>> Without any specific questions, you're not going to get anything more
>> than a basic eyeballing of the code.
>
>
> Try running the program.
>
> (I did that but I can't follow this style of coding so can't help.)

I don't run arbitrary code. I eyeball it instead.

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


Re: No module named vtkCommonCorePython

2017-05-20 Thread Jason Friedman
>
> I have a problem to finding file in Python path,Anybody knows how to solve
> it?
>
> Unexpected error: 
> Traceback (most recent call last):
>   File 
> "/home/nurzat/Documents/vmtk-build/Install/bin/vmtklevelsetsegmentation",
> line 20, in 
> from vmtk import pypeserver
>   File "/usr/local/lib/python2.7/dist-packages/vmtk-1.3.linux-
> x86_64.egg/vmtk/pypeserver.py", line 15, in 
> import vtk
>   File "/usr/local/lib/python2.7/dist-packages/vmtk-1.3.linux-
> x86_64.egg/vmtk/vtk/__init__.py", line 41, in 
> from .vtkCommonCore import *
>   File "/usr/local/lib/python2.7/dist-packages/vmtk-1.3.linux-
> x86_64.egg/vmtk/vtk/vtkCommonCore.py", line 9, in 
> from vtkCommonCorePython import *
> ImportError: No module named vtkCommonCorePython
>
> I tried a  search and got several hits for this
exact error.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I need help with making my claculator

2017-05-20 Thread Steve D'Aprano
On Sat, 20 May 2017 09:13 pm, bartc wrote:

> On 20/05/2017 03:10, Chris Angelico wrote:
>> Without any specific questions, you're not going to get anything more
>> than a basic eyeballing of the code.
> 
> Try running the program.
> 
> (I did that but I can't follow this style of coding so can't help.)

Chris is within his rights to refuse to run untrusted code downloaded over
the internet.

It's not even the security aspect: the code is fairly short, and doesn't
appear to be obfuscated or do anything nasty.

But its a matter of fairness: we're volunteers, not slaves or paid workers,
and we get to choose on what problems we work on.

We're not being paid to solve people's problems, we're doing it from a sense
of community (and maybe to show off, a bit). We've only got so much time
and energy for solving people's problems, and the more vague those problems
are, the less likely we are to care enough to put the work in to solve it.

Give us an interesting problem, and some of us will put *hours* of work into
it. But give us something vague or boring or trivial, and What's In It For
Us?

The Original Poster garsink at gmail.com cares so little for our time that
he or she didn't even *ask* a question. Or give a name we can call them
(email addresses are so impersonal and unfriendly). Nothing but a pair of
statements: I need help, here's my code.

Well, we all need help, and thank you for sharing.

Why should we bother to run your code if you can't even be bothered to say
Please or Thank You or tell us what's wrong with it?

"garsink", or whatever you would like us to call you, please help us to help
you. Don't expect us to run your code until you've made it interesting for
us. Please read this webpage before answering:

http://sscce.org/

It is written for Java programmers, but it applies to Python too.

Thank you.



-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


Re: How to install Python package from source on Windows

2017-05-20 Thread Gregory Ewing

Steve D'Aprano wrote:


Or /sbin or /usr/sbin or /opt :-)


Yes, there are a few others. The point is that there is a small
number of standard places for executables, and if you have them
on your path, you're good to go.

With Visual Studio it seems things get installed somewhere
that's not on your path by default, and you're expected to run
a script to start a console window with the path set up
properly.

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


Re: I need help with making my calculator

2017-05-20 Thread Steve D'Aprano
On Sat, 20 May 2017 11:42 am, gars...@gmail.com wrote:

> m using Python 3.4.2
> This is my code:

Please read this first:

http://sscce.org/

And then indent the "calc" method so that it is part of the class:

> def calc(self, display):
> try:
> display.set(eval(display.get()))
> except:
> display.set("Type an actual equation please!")

That's not indented. It needs to be indented by one level.




-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Gregory Ewing

Chris Angelico wrote:

They're function metadata. What would the principle of least surprise
say about this?

print("Spam")
def func(arg: print("Foo") = print("Quux")):
print("Blargh")
print("Fred")
func()
print("Eggs")


Most languages that have static type declarations wouldn't
let you write something like that in the first place, so the
fact that Python does is surprising to begin with.

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


Re: I need help with making my claculator

2017-05-20 Thread Joel Goldstick
On Sat, May 20, 2017 at 9:49 AM, Steve D'Aprano
 wrote:
> On Sat, 20 May 2017 09:13 pm, bartc wrote:
>
>> On 20/05/2017 03:10, Chris Angelico wrote:
>>> Without any specific questions, you're not going to get anything more
>>> than a basic eyeballing of the code.
>>
>> Try running the program.
>>
>> (I did that but I can't follow this style of coding so can't help.)
>
> Chris is within his rights to refuse to run untrusted code downloaded over
> the internet.
>
> It's not even the security aspect: the code is fairly short, and doesn't
> appear to be obfuscated or do anything nasty.
>
> But its a matter of fairness: we're volunteers, not slaves or paid workers,
> and we get to choose on what problems we work on.
>
> We're not being paid to solve people's problems, we're doing it from a sense
> of community (and maybe to show off, a bit). We've only got so much time
> and energy for solving people's problems, and the more vague those problems
> are, the less likely we are to care enough to put the work in to solve it.
>
> Give us an interesting problem, and some of us will put *hours* of work into
> it. But give us something vague or boring or trivial, and What's In It For
> Us?
>
> The Original Poster garsink at gmail.com cares so little for our time that
> he or she didn't even *ask* a question. Or give a name we can call them
> (email addresses are so impersonal and unfriendly). Nothing but a pair of
> statements: I need help, here's my code.
>
> Well, we all need help, and thank you for sharing.
>
> Why should we bother to run your code if you can't even be bothered to say
> Please or Thank You or tell us what's wrong with it?
>
> "garsink", or whatever you would like us to call you, please help us to help
> you. Don't expect us to run your code until you've made it interesting for
> us. Please read this webpage before answering:
>
> http://sscce.org/
>
> It is written for Java programmers, but it applies to Python too.
>
> Thank you.
>
>
>
> --
> Steve
> Emoji: a small, fuzzy, indistinct picture used to replace a clear and
> perfectly comprehensible word.
>
> --
> https://mail.python.org/mailman/listinfo/python-list

I took a look at the url from the email address.  Its some private
school for apparently youngish kids.  So, a little perspective on the
rather vague query.

Poster, maybe try the python-tutor mailing list

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] aioxmpp 0.9 released

2017-05-20 Thread Jonas Wielicki
Dear subscribers,

We are pleased to announce the release of aioxmpp 0.9. The current release can 
be obtained from GitHub [1] (check out the v0.9.0 tag or the master branch) or 
PyPI [2]. The HTML documentation can be found at [3]. Examples can be found in 
the GitHub repository, in the examples sub directory.


aioxmpp is a Python library based on asyncio. It implements the client side of 
the XMPP protocol (RFC 6120 and others). For a more detailed description of 
the package, please review the README of the package on GitHub [1] or on PyPI
[2]. For more information on XMPP, please see [8]. aioxmpp is licensed under 
the terms of the GNU Lesser General Public License Version 3.0 or later.


Version 0.9 is a feature release. Many new XMPP Extensions (XEPs) have been 
implemented in this release, to a great extent thanks to [@sebastianriese]. A 
few highlights include:

* Support for [XEP-0163] (Personal Eventing Protocol), which is used for 
  server-side broadcast and storage of account information.

* Support for [XEP-0084] (User Avatar), [XEP-0049] (Private XML Storage, 
  nowadays often replaced by XEP-0163), and [XEP-0048] (Bookmarks).

* A new subpackage (aioxmpp.im) [10] which focuses on modern Instant Messaging
  features has been introduced. It is still very experimental, but does 
  already support Message Carbons. The Multi-User Chat implemementation has
  been ported to adhere to that interface. See the linked docs to see where
  the journey is going, it’s hard to summarize in a single paragraph!

The full list of new features is, as always, included in the changelog [9] 
included in the official documentation.


Bugs, feature requests, patches and questions can be directed to either the
aioxmpp mailing list [4], the GitHub issue tracker [5] or the XMPP Multi-User
chat [6], whatever floats your boat. Please direct security-relevant issue
reports directly to me (jo...@wielicki.name), preferably encrypted using my
GPG public key [7].

best regards and happy-asyncio-ing,
Jonas Wielicki


   [1]: https://github.com/horazont/aioxmpp
   [2]: https://pypi.python.org/pypi/aioxmpp
   [3]: https://docs.zombofant.net/aioxmpp/0.9/
   [4]: https://lists.zombofant.net/mailman/listinfo/aioxmpp-devel
   [5]: https://github.com/horazont/aioxmpp/issues
   [6]: aiox...@conference.zombofant.net
   [7]: https://sks-keyservers.net/pks/lookup?op=get&search=0xE5EDE5AC679E300F
AA5A 78FF 508D 8CF4 F355  F682 E5ED E5AC 679E 300F
   [8]: https://xmpp.org/
   [9]: https://docs.zombofant.net/aioxmpp/0.9/api/changelog.html#version-0-9
   [10]: https://docs.zombofant.net/aioxmpp/0.9/api/public/im.html
   [XEP-0048]: https://xmpp.org/extensions/xep-0048.html
   [XEP-0049]: https://xmpp.org/extensions/xep-0049.html
   [XEP-0084]: https://xmpp.org/extensions/xep-0084.html
   [XEP-0163]: https://xmpp.org/extensions/xep-0163.html
   @sebastianriese: https://github.com/sebastianriese/

signature.asc
Description: This is a digitally signed message part.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Gregory Ewing

Steve D'Aprano wrote:

You mean treat them as syntactically comments?

def function(arg:I can put ***ANYTHING*** I like here!!!):


They could be parsed as expressions and stored as an AST.
That would allow introspection, and you could evaluate them
if you wanted


Ever since they were introduced, annotations have always been evaluated and
recorded in the function.__annotations__ attribute.


Yes, but I'm not sure how much good that does you. Because
of the forward-reference thing, you need to be prepared to
get a string instead of a type object, in which case you
need to do some evaluation on it yourself anyway.

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


Re: I need help with making my claculator

2017-05-20 Thread bartc

On 20/05/2017 14:49, Steve D'Aprano wrote:

On Sat, 20 May 2017 09:13 pm, bartc wrote:



Try running the program.

(I did that but I can't follow this style of coding so can't help.)


Chris is within his rights to refuse to run untrusted code downloaded over
the internet.

It's not even the security aspect: the code is fairly short, and doesn't
appear to be obfuscated or do anything nasty.

But its a matter of fairness: we're volunteers, not slaves or paid workers,
and we get to choose on what problems we work on.


I think of these as little puzzles to solve.

And in this case, it had a nifty little display; but I couldn't even get 
to the point where I could use that display setup as a start point and 
add my own logic to make it work.


(Could such a program be implemented using simple linear logic? I dusted 
off some old, half-finished graphics library of mine [not Python] and 
tried emulating a 4-function calculator. The answer was yes, it could. 
For a simple app like this, you don't need classes or lambdas or 
whatever else it is using; a simple loop will do.)



We're not being paid to solve people's problems, we're doing it from a sense
of community (and maybe to show off, a bit). We've only got so much time
and energy for solving people's problems, and the more vague those problems
are, the less likely we are to care enough to put the work in to solve it.

Give us an interesting problem, and some of us will put *hours* of work into
it. But give us something vague or boring or trivial, and What's In It For
Us?


OK, if I ever get stuck with a Python problem, I'd better make it 
interesting then!


--
bartc

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


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Chris Angelico
On Sat, May 20, 2017 at 11:58 PM, Gregory Ewing
 wrote:
> Chris Angelico wrote:
>>
>> They're function metadata. What would the principle of least surprise
>> say about this?
>>
>> print("Spam")
>> def func(arg: print("Foo") = print("Quux")):
>> print("Blargh")
>> print("Fred")
>> func()
>> print("Eggs")
>
>
> Most languages that have static type declarations wouldn't
> let you write something like that in the first place, so the
> fact that Python does is surprising to begin with.

This is true. But since Python _does_ work with dynamic evaluation
(which consequently demands that these kinds of things be expressions
evaluated at compile time), it must by definition be possible to have
side effects. Of course, you would never actually do this in
production code, but I've often made use of the fact that a function's
default argument isn't technically a constant - for example:

DEFAULT_URL = "http://yada.yada.example/";
if testing:
DEFAULT_URL = "http://yada.yada.localhost/";
if staging:
DEFAULT_URL = "http://yada.yada.test.example/";

...

def do_stuff(thing, *, url=DEFAULT_URL):

It has to be evaluated at run time, but from the programmer's point of
view, it's a constant. In C, for instance, this kind of thing would
generally be done with #if and #define.

Like everything in Python, there is a well-defined order of
evaluation, just in case it matters. I wouldn't hazard a guess as to
how often it will, but it's good to know that if it does, you can just
test it once and then be confident :)

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


Re: How to install Python package from source on Windows

2017-05-20 Thread Viktor Hagström
I have followed this discussion since the beginning, and I have been intrigued. 
I recently read a relevant blog post that I'd like to share. It has arguments 
for both sides: http://nullprogram.com/blog/2017/03/30/.

2017-05-20 0:01 GMT+02:00 eryk sun 
mailto:eryk...@gmail.com>>:
On Fri, May 19, 2017 at 9:18 PM, bartc 
mailto:b...@freeuk.com>> wrote:
> On 19/05/2017 19:53, eryk sun wrote:
>>
>> On Fri, May 19, 2017 at 1:57 PM, bartc 
>> mailto:b...@freeuk.com>> wrote:
>
>
>>> The 'improvement' seems to involve making things more complicated rather
>>> than less.
>
>
>> You don't need a full Visual Studio 2015 installation. You can install
>> Visual C++ 2015 Build Tools [1], which includes MSBuild, and use the
>> x86 or x64 native tools command prompt. Install the WDK to get the
>> Windows debuggers windbg, cdb, kd, and ntsd.
>>
>> To build the external dependencies, you'll need svn and nasm in PATH.
>> You don't need git if you've downloaded the source manually. Ignore
>> the warning if it can't find git.
>>
>> [1]: http://landinghub.visualstudio.com/visual-cpp-build-tools
>
> TBH I've no idea what most of these things do. So if something goes wrong, I
> can't hack my way around them.
>
> (And things will go wrong; I've just tried to uninstall VS2017, as I think
> it was, and eventually it said 'Uninstall Failed'! I download msbuild tools
> you suggested. MSBUILD, I simply don't know how to use. CL, either it can't
> find it, or it crashes. So forget it.

MSBuild is a build tool for C/C++ and .NET projects that are defined
by XML project files. You need it to build CPython via pcbuild.proj.

Run the x64 or x86 native tools command prompt to set up the
command-line build environment (PATH, INCLUDE, LIB). Assuming
everything is set up right, you should have no problem running cl.exe
and link.exe.
--
https://mail.python.org/mailman/listinfo/python-list

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


Re: How to install Python package from source on Windows

2017-05-20 Thread breamoreboy
On Thursday, May 18, 2017 at 8:32:18 PM UTC+1, bartc wrote:
> On 18/05/2017 18:11, Steve D'Aprano wrote:
> 
> > Seems a bit hypocritical, don't you think? Expecting people to go spelunking
> > into your undocumented mystery language source code to work out how to
> > build it from source, and then turning around and complaining that Python's
> > build process:
> >
> > PCbuild\build.bat -e -d
> >
> >
> > is too complicated.
> 
> 
> You're right of course. But it makes you wonder then why they bother 
> making available binary builds of Python for Windows, when someone just 
> needs to enter a simple command and it will effortlessly build you a 
> customised version from source.
> 
> 
> -- 
> bartc

Enough is enough.  It is quite clear to me and has been ever since he started 
on this list that he knows squat about programming.  Please can we get rid of 
this troll.  He knows as much about Python and/or programming as the RUE knows 
about PEP 393.

Kindest regards.

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


Re: How to install Python package from source on Windows

2017-05-20 Thread breamoreboy
On Friday, May 19, 2017 at 1:41:02 AM UTC+1, Michael Torrie wrote:
> On 05/18/2017 05:15 PM, Steve D'Aprano wrote:
> > Oh but this is Bart we're talking about. Of course his code generator is
> > perfect, it is unthinkable that it emits incorrect code.
> 
> I think we've picked on Bart enough for one day.  Fortunately he seems
> rather good natured, but this is bordering on the ad hominem in my
> opinion.  Sure Bart's posts often reflect a bit of confrontation in
> regards to his own programming languages vs Python.  But I don't think
> an attack ("of course his code generator is perfect") is called for.
> 

I disagree entirely.  For a person who claims to have 40 years programming 
experience I say he's completely clueless.  Until such time as he can show that 
he understands source code control, the difficulties in building cross platform 
code and the other 1,000,001 problems that people who have to work in teams 
have to put up with on a daily basis, I will not be changing my opinion.  Run 
time speed, which he is completely obsessed with, is for 99.99% of programmers 
in the 21st century irrelevant.

Kindest regards.

Mark Lawrence.

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


Re: getting the center of mass of each part of a molecule

2017-05-20 Thread qasimpars
I have more than 100 ligand molecules. The image I showed at the beginning of 
this discussion was only an example. It had missing atoms. 
See it without missing any atom in the pdb format (coordinates in Angstrom 
unit):
ATOM  1  O1  LIG 1  46.050  50.290  26.860
ATOM  2  O2  LIG 1  46.070  47.530  27.170  
ATOM  3  C1  LIG 1  47.630  49.260  23.730
ATOM  4  C2  LIG 1  48.200  49.870  22.500
ATOM  5  C3  LIG 1  47.090  50.070  24.730   
ATOM  6  C4  LIG 1  46.570  49.490  25.890   
ATOM  7  C5  LIG 1  47.650  47.870  23.890
ATOM  8  C6  LIG 1  46.590  48.100  26.040 
ATOM  9  C7  LIG 1  47.120  47.290  25.050
ATOM 10  C8  LIG 1  47.160  50.610  21.680
ATOM 11  C9  LIG 1  46.450  51.660  26.860
ATOM 12  C10 LIG 1  46.910  51.920  21.790
ATOM 13  H1  LIG 1  48.640  49.150  21.820 
ATOM 14  H2  LIG 1  48.980  50.600  22.700   
ATOM 15  H3  LIG 1  47.080  51.150  24.610
ATOM 16  H4  LIG 1  48.070  47.240  23.110
ATOM 17  H5  LIG 1  47.140  46.210  25.170
ATOM 18  H6  LIG 1  46.580  50.030  20.960
ATOM 19  H7  LIG 1  45.570  52.300  26.810
ATOM 20  H8  LIG 1  47.090  51.850  26.000
ATOM 21  H9  LIG 1  47.000  51.860  27.780
ATOM 22  H10 LIG 1  46.190  48.140  27.920
ATOM 23  H11 LIG 1  46.220  52.400  21.250
ATOM 24  H12 LIG 1  46.750  52.530  22.680 

The same ligand coordinate file in gro format (coordinates in nanometer unit) 
is here as well: 
1LIG O11   4.605   5.029   2.686
1LIG O22   4.607   4.753   2.717
1LIG C13   4.763   4.926   2.373
1LIG C24   4.820   4.987   2.250
1LIG C35   4.709   5.007   2.473
1LIG C46   4.657   4.949   2.589
1LIG C57   4.765   4.787   2.389
1LIG C68   4.659   4.810   2.604
1LIG C79   4.712   4.729   2.505
1LIG C8   10   4.716   5.061   2.168
1LIG C9   11   4.645   5.166   2.686
1LIGC10   12   4.691   5.192   2.179
1LIG H1   13   4.864   4.915   2.182
1LIG H2   14   4.898   5.060   2.270
1LIG H3   15   4.708   5.115   2.461
1LIG H4   16   4.807   4.724   2.311
1LIG H5   17   4.714   4.621   2.517
1LIG H6   18   4.658   5.003   2.096
1LIG H7   19   4.557   5.230   2.681
1LIG H8   20   4.709   5.185   2.600
1LIG H9   21   4.700   5.186   2.778
1LIGH10   22   4.619   4.814   2.792
1LIGH11   23   4.622   5.240   2.125
1LIGH12   24   4.675   5.253   2.268
I am doing molecular dynamics simulation of protein-ligand complex. The issue 
is to keep the ligand in the binding site of the protein during simulation when 
turned off the interactions (van der waals, coulomb...) between the ligand and 
protein. In that case, to keep the ligand in the bindind site I need to apply 
the translational and rotational restraints (distance, angle, dihedral 
restraints). The more detail is here 
http://pubs.acs.org/doi/abs/10.1021/jp0217839

My aim is to get the COM of the whole ligand (I already do it) and divide the 
ligand in two parts and find to the COM of each part. Then I will apply the 
distance, angle and dihedral restraints on the atoms of the ligand and protein. 
 
-The first distance restraints will be between one of the ligand heavy atom 
closest to the ligand COM (COM for whole ligand atoms) and one of the protein 
atoms closest to the ligand COM. 
-The second distance restraints  will be between one of the ligand heavy atom 
closest to the COM of the first part of ligand in two parts and one of the 
protein atoms closest to the COM of the first part of ligand in two parts. 
-And the third distance restraints  will be between one of the ligand heavy 
atom closest to the COM of the second part of ligand in two parts and one of 
the protein atoms closest to the COM of the second part of ligand in two parts.

That is, I will form 3 bonds between ligand and protein. Hope that makes clear 
what I am trying to do.

Please tell me on the python code what I need to do.

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


سكس اسرائيلى موقع سميرة الشرموطة موقع الشرموطة سميرة موقع ميلتا للجنس العربي موقع مليتا للسكس العربي موقع مليتا موقع 89

2017-05-20 Thread cyprus news

سكس اسرائيلى موقع سميرة الشرموطة موقع الشرموطة سميرة موقع ميلتا للجنس العربي 
موقع مليتا للسكس العربي موقع مليتا موقع 89 

سكس منيوكه مرفت جنس منيوكة مصرية منديات عرب لبنان سكس منتديات فلام إغتصاب 
منتديات سكسية منتديات سكس منتديات شرموطة منتديات رومنسي السكسية منت




https://mslslat2017.blogspot.com.cy/
https://mslslat2017.blogspot.com.cy/ 

 
سكس اسرائيلى موقع سميرة الشرموطة موقع الشرموطة سميرة موقع ميلتا للجنس العربي 
موقع مليتا للسكس العربي موقع مليتا موقع 89 سكس منيوكه مرفت جنس منيوكة مصرية 
منديات عرب لبنان سكس منتديات فلام إغتصاب منتديات سكسية منتديات سكس منتديات 
شرموطة منتديات رومنسي السكسية منتديات جنسيه مجانيه منتديات جنسية منتديات افلام 
سكس مصريلمجاني دون اشتراك افلام فيفى عبدة سكس افلام فيديو سوري مع سودانيين 
افلام عربيه سكسي افلام عراقية خليعة افلام سكس من مواقع غير محجوبه افلام سيكس 
ورعان افلام سيكس مصرية افلام جنس عربيه مجانيه افلام جنس مجانا افلام تونسيه 
زبيده ثروت افلام بلوتوث افلام الفمر المصرى قصيرة للتحميل المجانى دون افلام 
ميرفت امين السكس افلام محارم جنسية افلام لبنانية مثيرة افلام دعارة عربية افلا 
سكس للفنانات افلا م عربى سكس افلم وصور سيكس اغنية شو بني للموبايل اغتصاب نساء 
بنات اطفال عراقيات مجاني اغتصاب ورعان اغانىعربيه اغاني ننسي عجرم اغاني هجوله 
استماع اغاني عن البنات ممنوعه اغانى حديثة اغاني افلام كارتون سبيستون اغاني 
اجنبي قديمه mp3 اغانى اجنبي ديسكو اغاني للموبايل mp3 اغاني لورده الجزاءريه 
لتنزيل اغا ني مصربة اغا نى لحن اغا بى شعبى اسماء لافلام سكس بالعربيه ارقام 
موبيل للتعارف اريد سكسا اريد مواقع مسيحية للاطفال اريد مشاهدة صور سكس مجاتا اخر 
اخبار الممثلات العرب اخر مقاطع للاغاني اجدد الصور للفنانين اجانب اجدد الصور 
للفنانين مصريين اجدد الافلام السكس الاجنبيه احدث قصص محارم احدث صور باسكال احدث 
رقص شرقى مجانا احدث برامج مليتا احدث افلم اجنبى احدث النيك احدث الصور العربية 
السكسية احدث مقاطع اغانى احدث موقع سكسي احدث موقع اباحي اخبار الفنا نا ت 
ايميلات شراميط ايميلات بنات مصريه احلى قصص السكس العربية احلى قحبه احلي جنس 
مصري احلى بزاز احلى مغربية في جدة احلا طيز اجمل فلام سكس اجمل صور سكس للفنانات 
الخليج اجمل شرموطه سوريه اجمل رقص مصري اجمل جميلات تركيا اجمل الصور السكسية 
اجمل الصور للفنانات اجمل المواقع السكسية اجمل موقع السكس العربى اافلام سكس 
عربية ااغاني فلسطينيه شعبيه ااغانى عرب نت ااغانى تونسيه االجنس التونسي الكس 
العربي الكس القطيف سكس اموزش شو جنسي النيك وجنس المحارم النيك الفرنسي النيك 
الليبى النيك الهام شاهين شرموطة الهام شاهين اجمل صور الهام شاهين الفنانه الهام 
الفضاله الفتاة السكسيه العاب قذرة مضحكة العاب للبنات فقط-جديدة - العا ب بنات 
فقط العا ب العا ب العب السكسيه لى ناديه الجندى السكس عاشق البلوتوثات السكس 
المجانى السكس اللبناني السكس الصور السکس الشرموطه السعوديه الشرموطة نانا 
الشرموطة فاطمة الشرموطة ليلى السحاقية هالة سرحان السحاق الزب العربي الراقصه شمس 
الينات السكس البحث عن فليم سكس عربى الافلام السكسيه فيديو الافلام السكس الاعاب 
سيارات الامير للسكس المراه والسكس ا فلا م سكس ا غا نى عر بية أكبر شرموطه مكتبه 
سميره السكسيه مكتبة سكس عربى مكتبة سميره للقصص الجنس
 
-- 
https://mail.python.org/mailman/listinfo/python-list


سكس اسرائيلى موقع سميرة الشرموطة موقع الشرموطة سميرة موقع ميلتا للجنس العربي موقع مليتا للسكس العربي موقع مليتا موقع 89

2017-05-20 Thread cyprus news
سكس اسرائيلى موقع سميرة الشرموطة موقع الشرموطة سميرة موقع ميلتا للجنس العربي 
موقع مليتا للسكس العربي موقع مليتا موقع 89 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to install Python package from source on Windows

2017-05-20 Thread Chris Angelico
On Sat, May 20, 2017 at 8:46 AM, Viktor Hagström
 wrote:
> I have followed this discussion since the beginning, and I have been 
> intrigued. I recently read a relevant blog post that I'd like to share. It 
> has arguments for both sides: http://nullprogram.com/blog/2017/03/30/.
>

"""
There’s a much easier solution: Document that the application
requires, say, C99 and POSIX.1-2001. It’s the responsibility of the
person building the application to supply these implementations, so
there’s no reason to waste time testing for it.
...
...
But what about Windows
"""

Yeah. That's the big problem. It's all very well to say "this
application assumes POSIX". Yeah, thanks, that's easy... except on
Windows. Even if you just say "this application requires C99", you may
run into trouble compiling on Windows, because MSVC doesn't support
all of C99 (or maybe it does now in the very latest version, but if
you want to target all Windowses still in MS support, you have to use
an older MSVC that doesn't), and other compilers (eg mingw) don't
always have proper support for Windows integration. Demanding C99 and
POSIX works only if you're prepared to say "Windows is a second-class
citizen, supported on a best-effort basis only"; you basically have to
demand a full set of GNU build tools, and then forego any sort of real
Windows support - particularly as regards a GUI. And the little caveat
at the end about file names? That's a HUGE deal. The difference
between Windows and POSIX path names is nontrivial. On POSIX, there
are two types of path: absolute (starting with a slash) and relative
(not starting with a slash). You might want to consider tilde
expansion ("~/.bashrc" means "your home directory/.bashrc", and
"~user/.bashrc" means "user's home dir/.bashrc"), but that's a feature
of the shell, not the file system. On Windows? You can have
fully-absolute paths that begin with a drive letter and a slash; you
can have fully-relative paths that begin with neither; and you can
have partially-relative paths that have one or the other. Which means
that, on Windows, you can have "c:xyz" and "d:xyz" and they're
relative to *different* base paths. Have fun coping with that one.

Truly portable code either targets the lowest common denominator,
which means avoiding any sort of file system processing or any
features not in C89, or has multiple branches. That's the only two
ways to do it.

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


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Steve D'Aprano
On Sun, 21 May 2017 12:14 am, Gregory Ewing wrote:

> Steve D'Aprano wrote:
>> You mean treat them as syntactically comments?
>> 
>> def function(arg:I can put ***ANYTHING*** I like here!!!):
> 
> They could be parsed as expressions and stored as an AST.
> That would allow introspection, and you could evaluate them
> if you wanted


Ooh, that's a nice idea!




-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


Re: Finding sentinel text when using a thread pool...

2017-05-20 Thread Christopher Reimer via Python-list

On 5/20/2017 1:19 AM, dieter wrote:


If your (590) pages are linked together (such that you must fetch
a page to get the following one) and page fetching is the limiting
factor, then this would limit the parallelizability.


The pages are not linked together. The URL requires a page number. If I 
requested 1000 pages in sequence, the first 60% will have comments and 
the remaining 40% will have the sentinel text. As more comments are 
added over time, the dividing line between the last page with the oldest 
comments and the first page with the sentinel page shifts over time. 
Since I changed the code to fetch 16 pages at the same time, the run 
time got reduced by nine minutes.



If processing a selected page takes a significant amount of time
(compared to the fetching), then you could use a work queue as follows:
a page is fetched and the following page determined; if a following
page is found, processing this page is put as a job into the work queue
and page processing is continued. Free tasks look for jobs in the work queue
and process them.


I'm looking into that now. The requester class yields one page at a 
time. If I change the code to yield a list of 16 pages, I could parse 16 
pages at a time. That change would require a bit more work but it would 
fix some problems that's been nagging me for a while about the parser class.


Thank you,

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


Re: How to install Python package from source on Windows

2017-05-20 Thread bartc

On 20/05/2017 17:49, Chris Angelico wrote:

On Sat, May 20, 2017 at 8:46 AM, Viktor Hagström
 wrote:

I have followed this discussion since the beginning, and I have been intrigued. 
I recently read a relevant blog post that I'd like to share. It has arguments 
for both sides: http://nullprogram.com/blog/2017/03/30/.



Truly portable code either targets the lowest common denominator,
which means avoiding any sort of file system processing or any
features not in C89, or has multiple branches. That's the only two
ways to do it.


Why avoid file processing? Standard C has long had fopen and fclose, and 
a handful of other functions (basically to read files and to write 
them). You don't need much else.


That blog link also had a reader comment that included these remarks:

"CMake and other tools that build build-configuration projects are 
overly complex and are an impediment to the software development cycle. 
They hide details like compile and link options, or make you use their 
language/syntax to express those options, and don't help you avoid 
os-dependent configuration issues."


It goes on [after Cmake was replaced]:

"A fresh build would run in a couple of minutes instead of 17 minutes. 
If no changes are made, it would take Visual Studio and Cmake 20-30 
seconds to determine there was nothing to build. Now it takes a split 
second.


...Keep the build as simple as possible."

(Which is exactly what I strive to do. Although my projects are small, 
they could still involve dozens of source and support files, and require 
running non-standard tools to build, which would then require other sets 
of sources to built those.


It still doesn't work though because you can get down to just a single 
file, and people will still moan that it's too complex. You've reduced 
the job of building a set of kitchen units to hammering in just one 
nail, but then find that someone has never hammered a nail in before.


I'm now investigating how to reduce a project to no files at all!)

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


Re: How to install Python package from source on Windows

2017-05-20 Thread Chris Angelico
On Sun, May 21, 2017 at 4:11 AM, bartc  wrote:
> On 20/05/2017 17:49, Chris Angelico wrote:
>>
>> On Sat, May 20, 2017 at 8:46 AM, Viktor Hagström
>>  wrote:
>>>
>>> I have followed this discussion since the beginning, and I have been
>>> intrigued. I recently read a relevant blog post that I'd like to share. It
>>> has arguments for both sides: http://nullprogram.com/blog/2017/03/30/.
>
>
>> Truly portable code either targets the lowest common denominator,
>> which means avoiding any sort of file system processing or any
>> features not in C89, or has multiple branches. That's the only two
>> ways to do it.
>
>
> Why avoid file processing? Standard C has long had fopen and fclose, and a
> handful of other functions (basically to read files and to write them). You
> don't need much else.

What's a file name consist of? Is it:

* A series of bytes, terminated by \x00?
* A series of bytes that must be decodable as UTF-8?
* A series of sixteen-bit units which may or may not be decodable as UTF-16?

What byte values and what character values are legal? How do you
describe a path, or can you only work in the current directory? What
is a drive letter, can you use it, and what happens if you omit it?

The answers to these questions are not the same on all of today's
platforms - and that's even assuming that you can ignore older systems
like the pre-BSD Mac OS, or the Amiga.

You can *probably* restrict yourself to the current directory and to a
limited set of safe file name characters (all of which are ASCII, but
not all of ASCII is safe). Probably. But I wouldn't bet my life on
even that.

> ...Keep the build as simple as possible."
>
> (Which is exactly what I strive to do. Although my projects are small, they
> could still involve dozens of source and support files, and require running
> non-standard tools to build, which would then require other sets of sources
> to built those.

Dozens? Oh you poor wee lamb.

rosuav@sikorsky:~/cpython$ find -name \*.c -or -name \*.h | wc -l
672

rosuav@sikorsky:~/pike$ find -name \*.c -or -name \*.h | wc -l
701

rosuav@sikorsky:~/wine$ find -name \*.c -or -name \*.h | wc -l
3981

rosuav@sikorsky:~/linux$ find -name \*.c -or -name \*.h | wc -l
44546

These repositories, by the way, correspond to git URLs
https://github.com/python/cpython,
git://pike-git.lysator.liu.se/pike.git,
git://source.winehq.org/git/wine, and
https://github.com/torvalds/linux respectively, if you want to check
my numbers. Two language interpreters, a popular execution subsystem,
and an OS kernel.

I'd like to see you create a single-file version of the Linux kernel
that compiles flawlessly on any modern compiler and has no configure
script.

> It still doesn't work though because you can get down to just a single file,
> and people will still moan that it's too complex. You've reduced the job of
> building a set of kitchen units to hammering in just one nail, but then find
> that someone has never hammered a nail in before.
>
> I'm now investigating how to reduce a project to no files at all!)

Good, you do that. That fits in the same sort of puzzle space as
building a Turing tarpit. Meanwhile, the rest of us are actually doing
useful things with our lives.

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


Re: How to install Python package from source on Windows

2017-05-20 Thread Steve D'Aprano
On Sun, 21 May 2017 04:11 am, bartc wrote:

> You've reduced
> the job of building a set of kitchen units to hammering in just one
> nail

"Where's the fridge go?"

"You don't need a fridge. Just put things outside, in the snow. When it
snows."

"Okay, how do I install a gas oven?"

"Sorry, you can't have a gas oven. It has to be an electric stove only."

"Oh. I see there's a single-lever mixer tap on the sink. Can I have an
old-style tap with two handles? The water here is too hard, it plays merry
hell with the cartridges in mixer taps."

"No, that's not supported. It has to be a mixer tap, or nothing."

"Oh, you've installed a garbage disposal unit in the sink. But I'm not
connected to the sewerage system, all my waste water goes to a septic tank,
so I can't use an garbage disposal system."

"Garbage disposal unit is a hard requirement of this kitchen."

"Sorry, this really doesn't suit my needs."

"What? But don't you realise how easy it is to install???!??! Look at all
the cupboard room, you could fit enough pots and pans for an army in this
kitchen, and all it takes is one nail to install!!! That's all, one lousy
nail!!! What's wrong with you that you don't see how fantastic this is???
Ungrateful wretch."




-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


Re: How to install Python package from source on Windows

2017-05-20 Thread bartc

On 20/05/2017 19:37, Chris Angelico wrote:

On Sun, May 21, 2017 at 4:11 AM, bartc  wrote:



(Which is exactly what I strive to do. Although my projects are small, they
could still involve dozens of source and support files, and require running
non-standard tools to build, which would then require other sets of sources
to built those.


Dozens? Oh you poor wee lamb.

rosuav@sikorsky:~/cpython$ find -name \*.c -or -name \*.h | wc -l
672

rosuav@sikorsky:~/pike$ find -name \*.c -or -name \*.h | wc -l
701

rosuav@sikorsky:~/wine$ find -name \*.c -or -name \*.h | wc -l
3981

rosuav@sikorsky:~/linux$ find -name \*.c -or -name \*.h | wc -l
44546


This is rather fascinating actually.

Of those remarks I quoted it said that VS/Cmake took 17 minutes to do 
something instead of 2 minutes, or 1 second to check something instead 
of 20 seconds. What /I/ would like to know is, what is VS/Cmake *doing* 
in those extra 15 minutes, or the extra 19 seconds.


I would say there are two types of people: those who care about the 
answer, and those who don't.


And similarly, I'd quite like to know what all those 44546 files are 
for. I remember that Debian on Raspberry Pi reported there were 55,000 
files installed, yet every time you wanted to actually DO anything, you 
needed a sudo apt-get install!


There is some skill involved I think in keeping things small and 
manageable and at a human scale. I think that's largely been lost.



These repositories, by the way, correspond to git URLs
https://github.com/python/cpython,
git://pike-git.lysator.liu.se/pike.git,
git://source.winehq.org/git/wine, and
https://github.com/torvalds/linux respectively, if you want to check
my numbers. Two language interpreters, a popular execution subsystem,
and an OS kernel.

I'd like to see you create a single-file version of the Linux kernel
that compiles flawlessly on any modern compiler and has no configure
script.


I've written plenty of code to talk to the sort of hardware that I 
assume OSes are still largely concerned with. Those drivers were tiny; 
what's happened to make them so huge?


(Applications I wrote in the 80s had to DIRECTLY deal with colour 
graphics, pointing devices, fonts, printers and plotters. With multiple 
drivers for each graphics card, printer etc. /And/ emulate floating 
point. /And/ emulate virtual memory that swapped itself to disk. The OS 
only took care of the keyboard, and the file system. Yet, the entire 
application was STILL tiny!)


BTW /does/ Linux compile on /any/ modern compiler? I heard it was so 
difficult to compile that gcc had to be specially modified to make it 
possible.



Good, you do that. That fits in the same sort of puzzle space as
building a Turing tarpit. Meanwhile, the rest of us are actually doing
useful things with our lives.


Trying to keep the world simple isn't useful? Someone has to keep tabs 
on such things before technology grinds to a halt under the weight of 
all the software.


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


Re: How to install Python package from source on Windows

2017-05-20 Thread Larry Martell
On Sat, May 20, 2017 at 5:56 PM, bartc  wrote:
> I would say there are two types of people: those who care about the answer,
> and those who don't.

I say there are 10 types of people in this world. Those who understand
binary and those who don’t.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to install Python package from source on Windows

2017-05-20 Thread Michael Torrie
On 05/20/2017 03:56 PM, bartc wrote:
> BTW /does/ Linux compile on /any/ modern compiler? I heard it was so 
> difficult to compile that gcc had to be specially modified to make it 
> possible.

The kernel compiles with recent bog standard gcc compilers just fine.
The last time there was an issue was way back in the late 90s when
RedHat forked GCC and made EGCS, but unfortunately that couldn't compile
the kernel at the time, so they used an older version of GCC.
Eventually EGCS merged back into the GNU project and actually became GCC
(the old GCC faded away).

I'm pretty sure the kernel can compile with the Intel compiler.  I'm
actually pretty sure the kernel can compile with TCC too, or at least it
could at one time.  The biggest problem with non-GCC compilers is the
lack of GCC-specific extensions that the kernel uses.  There apparently
is a project to get the kernel to build with clang/llvm also.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Gregory Ewing

Chris Angelico wrote:

But since Python _does_ work with dynamic evaluation
(which consequently demands that these kinds of things be expressions
evaluated at compile time), it must by definition be possible to have
side effects.


In most languages, type declarations are not expressions
and aren't evaluated at all in the usual sense, so questions
of evaluation order and side effects just don't apply.

If we were designing a static typing system for Python from
scratch, I would be strongly arguing that type hints shouldn't
be expressions evaluated at run time, because it's such a
poor fit for the intended use. Introspectable by all means,
but evaluated by default, no.

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


Re: type hinting backward compatibility with python 3.0 to 3.4

2017-05-20 Thread Chris Angelico
On Sun, May 21, 2017 at 3:30 PM, Gregory Ewing
 wrote:
> Chris Angelico wrote:
>>
>> But since Python _does_ work with dynamic evaluation
>> (which consequently demands that these kinds of things be expressions
>> evaluated at compile time), it must by definition be possible to have
>> side effects.
>
>
> In most languages, type declarations are not expressions
> and aren't evaluated at all in the usual sense, so questions
> of evaluation order and side effects just don't apply.
>
> If we were designing a static typing system for Python from
> scratch, I would be strongly arguing that type hints shouldn't
> be expressions evaluated at run time, because it's such a
> poor fit for the intended use. Introspectable by all means,
> but evaluated by default, no.

How do you declare that a parameter must be an instance of some class?
Classes are themselves created at run time. Or would your typing
system require that all types be created in some declarable way?

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


multiprocessing.Process can not start a thread in py2exe

2017-05-20 Thread Ho Yeung Lee
p = multiprocessing.Process(target=helloconnect, args=(host,"",))

multiprocessing.Process can not start a thread in py2exe

it can compile and run without error
but it can not run function helloconnect
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing.Process can not start a thread in py2exe

2017-05-20 Thread Ho Yeung Lee
i mean executable file can not run the multiprocessing thread 
after convert to executable file with py2exe



On Sunday, May 21, 2017 at 2:09:04 PM UTC+8, Ho Yeung Lee wrote:
> p = multiprocessing.Process(target=helloconnect, args=(host,"",))
> 
> multiprocessing.Process can not start a thread in py2exe
> 
> it can compile and run without error
> but it can not run function helloconnect

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


AttributeError: 'module' object has no attribute 'urlretrieve' in window subsystem ubuntu bash for tensorflow

2017-05-20 Thread Ho Yeung Lee
i use window subsystem ubuntu 
and install python 3 and tensorflow

then when try deep learning

https://www.tensorflow.org/tutorials/wide_and_deep

got error when urlretrieve local directory in ubuntu in window

tried urllib3 still have error

import tempfile
import pandas as pd
import urllib as urllib
import os

model_dir = tempfile.mkdtemp()
m = tf.contrib.learn.DNNLinearCombinedClassifier(
model_dir=model_dir,
linear_feature_columns=wide_columns,
dnn_feature_columns=deep_columns,
dnn_hidden_units=[100, 50])

...

urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/data.csv", train_file.name)
urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/dataTest.csv", test_file.name)


Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'module' object has no attribute 'urlretrieve'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing.Process can not start a thread in py2exe

2017-05-20 Thread topic2k--- via Python-list
Did you call freeze_support() function after script start?
https://docs.python.org/3/library/multiprocessing.html#multiprocessing.freeze_support
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: multiprocessing.Process can not start a thread in py2exe

2017-05-20 Thread Ho Yeung Lee
On Sunday, May 21, 2017 at 2:40:49 PM UTC+8, top...@googlemail.com wrote:
> Did you call freeze_support() function after script start?
> https://docs.python.org/3/library/multiprocessing.html#multiprocessing.freeze_support


no, i did not call freeze_support()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: 'module' object has no attribute 'urlretrieve' in window subsystem ubuntu bash for tensorflow

2017-05-20 Thread Kev Dwyer
Ho Yeung Lee wrote:

> i use window subsystem ubuntu
> and install python 3 and tensorflow
> 
> then when try deep learning
> 
> https://www.tensorflow.org/tutorials/wide_and_deep
> 
> got error when urlretrieve local directory in ubuntu in window
> 
> tried urllib3 still have error
> 
> import tempfile
> import pandas as pd
> import urllib as urllib
> import os
> 
> model_dir = tempfile.mkdtemp()
> m = tf.contrib.learn.DNNLinearCombinedClassifier(
> model_dir=model_dir,
> linear_feature_columns=wide_columns,
> dnn_feature_columns=deep_columns,
> dnn_hidden_units=[100, 50])
> 
> ...
> 
> urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/data.csv",
> train_file.name)
> urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/dataTest.csv",
> test_file.name)
> 
> 
> Traceback (most recent call last):
>   File "", line 1, in 
> AttributeError: 'module' object has no attribute 'urlretrieve'


If you're using python3, you need to do:

from urllib.request import urlretrieve

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


Re: multiprocessing.Process can not start a thread in py2exe

2017-05-20 Thread Ho Yeung Lee
On Sunday, May 21, 2017 at 2:47:26 PM UTC+8, Ho Yeung Lee wrote:
> On Sunday, May 21, 2017 at 2:40:49 PM UTC+8, top...@googlemail.com wrote:
> > Did you call freeze_support() function after script start?
> > https://docs.python.org/3/library/multiprocessing.html#multiprocessing.freeze_support
> 
> 
> no, i did not call freeze_support()

no matter i call it or not in the first line of main , it still can not run
the thread function
-- 
https://mail.python.org/mailman/listinfo/python-list