Error installing libraries

2018-09-03 Thread ojas gupta
I am having trouble with installation of one library “mysqlclient” and it keeps 
on showing the same message  (copied below as it is
 ) .

THE MESSAGE :

C:\>pip install mysqlclient
Collecting mysqlclient
  Using cached 
https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
Complete output from command "c:\users\ojas 
gupta\appdata\local\programs\python\python37\python.exe" -u -c "import 
setuptools, 
tokenize;__file__='C:\\Users\\OJASGU~1\\AppData\\Local\\Temp\\pip-install-1d03ayeg\\mysqlclient\\setup.py';f=getattr(tokenize,
 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
C:\Users\OJASGU~1\AppData\Local\Temp\pip-record-wauonuy1\install-record.txt 
--single-version-externally-managed --compile:
c:\users\ojas 
gupta\appdata\local\programs\python\python37\lib\distutils\dist.py:274: 
UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying _mysql_exceptions.py -> build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.7\MySQLdb
creating build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> 
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> 
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> 
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> 
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> 
build\lib.win-amd64-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual 
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools


Command ""c:\users\ojas 
gupta\appdata\local\programs\python\python37\python.exe" -u -c "import 
setuptools, 
tokenize;__file__='C:\\Users\\OJASGU~1\\AppData\\Local\\Temp\\pip-install-1d03ayeg\\mysqlclient\\setup.py';f=getattr(tokenize,
 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
C:\Users\OJASGU~1\AppData\Local\Temp\pip-record-wauonuy1\install-record.txt 
--single-version-externally-managed --compile" failed with error code 1 in 
C:\Users\OJASGU~1\AppData\Local\Temp\pip-install-1d03ayeg\mysqlclient\


And the link provided to install Visual C++ 14.0 doesn’t  work . I installed 
Visual Studio 2017 and C++ Redistributable 2017 but same issue still .

It will be extremely appreciated if u help me . Thanks .
-- 
https://mail.python.org/mailman/listinfo/python-list


Anaconda with Python 3.7

2018-09-03 Thread gvim
Anyone have any idea when Anaconda might ship a version compatible with 
Python 3.7. I sent them 2 emails but no reply.


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


Re: Anaconda with Python 3.7

2018-09-03 Thread Thomas Jollans
On 2018-09-03 11:38, gvim wrote:
> Anyone have any idea when Anaconda might ship a version compatible with
> Python 3.7. I sent them 2 emails but no reply.
> 
> gvim

You can install Python 3.7 in a conda environment right now. Most
packages (certainly all the ones I use) appear to be available for
Python 3.7 at least on Windows and Linux already.


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


Cross platform mutex to prevent script running more than instance?

2018-09-03 Thread Malcolm Greene
Use case: Want to prevent 2+ instances of a script from running ...
ideally in a cross platform manner. I've been researching this topic and
am surprised how complicated this capability appears to be and how the
diverse the solution set is. I've seen solutions ranging from using
directories, named temporary files,  named sockets/pipes, etc. Is there
any consensus on best practice here?
Thank you,
Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error installing libraries

2018-09-03 Thread Thomas Jollans
On 2018-09-03 09:10, ojas gupta wrote:
> error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft 
> Visual C++ Build Tools": 
> http://landinghub.visualstudio.com/visual-cpp-build-tools
> 
> 
> Command ""c:\users\ojas 
> gupta\appdata\local\programs\python\python37\python.exe" -u -c "import 
> setuptools, 
> tokenize;__file__='C:\\Users\\OJASGU~1\\AppData\\Local\\Temp\\pip-install-1d03ayeg\\mysqlclient\\setup.py';f=getattr(tokenize,
>  'open', open)(__file__);code=f.read().replace('\r\n', 
> '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
> C:\Users\OJASGU~1\AppData\Local\Temp\pip-record-wauonuy1\install-record.txt 
> --single-version-externally-managed --compile" failed with error code 1 in 
> C:\Users\OJASGU~1\AppData\Local\Temp\pip-install-1d03ayeg\mysqlclient\
> 
> 
> And the link provided to install Visual C++ 14.0 doesn’t  work . I installed 
> Visual Studio 2017 and C++ Redistributable 2017 but same issue still .


mysqlclient binary packages for Windows are available from Christoph
Gohlke: https://www.lfd.uci.edu/~gohlke/pythonlibs/
If you use these you won't need a C compiler.


As for the C compiler issue, I'd expect installing Visual Studio 2017 to
work, but I've only ever used the standalone "build tools" with Python
on Windows myself...
See:
https://wiki.python.org/moin/WindowsCompilers#Compilers_Installation_and_configuration

> 
> It will be extremely appreciated if u help me . Thanks .
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Anaconda with Python 3.7

2018-09-03 Thread Thomas Jollans
On 2018-09-03 16:07, Alex Kaye wrote:
> When one downloads Anaconda, doesn't it
> bring Pyhon with it ?

It does, but one of the main features is the ability to create
additional virtual environments which can use different versions of
Python. You can even upgrade these environments to a different Python
version, and all the conda-installed (Python) packages will be installed
in the new Python version.

https://conda.io/docs/user-guide/tasks/manage-environments.html

-- Thomas

PS: Please always make sure you reply on-list.

> 
> AK
> 
> On Mon, Sep 3, 2018 at 6:13 AM Thomas Jollans  > wrote:
> 
> On 2018-09-03 11:38, gvim wrote:
> > Anyone have any idea when Anaconda might ship a version compatible
> with
> > Python 3.7. I sent them 2 emails but no reply.
> >
> > gvim
> 
> You can install Python 3.7 in a conda environment right now. Most
> packages (certainly all the ones I use) appear to be available for
> Python 3.7 at least on Windows and Linux already.
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cross platform mutex to prevent script running more than instance?

2018-09-03 Thread D'Arcy Cain
On 09/03/18 09:45, Malcolm Greene wrote:
> Use case: Want to prevent 2+ instances of a script from running ...
> ideally in a cross platform manner. I've been researching this topic and
> am surprised how complicated this capability appears to be and how the
> diverse the solution set is. I've seen solutions ranging from using
> directories, named temporary files,  named sockets/pipes, etc. Is there
> any consensus on best practice here?

Here's my simple method which works in pure Python so I guess that makes
it cross-platform.  Well, as long as it has process IDs anyway.  There's
a small window between reading the file and writing the new one but for
most purposes that should be OK.  If you have to worry about those
nano-second situations you will need to use one of those more
complicated methods.

import os, sys

def ok2run(lockfile):
mypid = os.getpid()

try: pid = int(open(lockfile).read())
except FileNotFoundError: pass
else:
try: os.kill(pid, 0)
except OSError: pass
else: return False

print(mypid, file=open(lockfile, 'w'))
return True

if not ok2run("/tmp/lockfile"): sys.exit(0)

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Why list.reverse() modifies the list, but name.replace() does not modify the string?

2018-09-03 Thread C W
Hello all,

I am learning the basics of Python. How do I know when a method modifies
the original object, when it does not. I have to exmaples:
Example 1:
> L = [3, 6, 1,4]
> L.reverse()
> L
[4, 1, 6, 3]
This changes the original list.

Example 2:
> name = "John Smith"
> name.replace("J", j")
> name
'John Smith'
This does not change the original string.

Why the two examples produce different results? As a beginner, I find this
confusing. How do you do it?

Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why list.reverse() modifies the list, but name.replace() does not modify the string?

2018-09-03 Thread Joel Goldstick
On Mon, Sep 3, 2018 at 1:50 PM C W  wrote:
>
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
> > L = [3, 6, 1,4]
> > L.reverse()
> > L
> [4, 1, 6, 3]
> This changes the original list.
>
> Example 2:
> > name = "John Smith"
> > name.replace("J", j")
> > name
> 'John Smith'
> This does not change the original string.
>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?
>
> Thank you!
> --
> https://mail.python.org/mailman/listinfo/python-list

Learn about help.  Go to python command line and type help(L) it will
show that this method reverses in place.  Type help(name) and it will
show that this method returns the result, but does not change your
list.

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


PyDev 6.5.0 released

2018-09-03 Thread Fabio Zadrozny
 PyDev 6.5.0 Release Highlights

   -

   *Debugger*
   - Debugger is *much* more responsive (fixed bug in reader/writer on the
  PyDev side).
  - *breakpoint()* builtin is now supported to add a programmatic
  breakpoint (on any Python version).
  - Watch expression no longer giving error if evaluation is empty
  (patch by glhez).
   -

   *Editor*
   - Code folding of *#region/#endregion* regions (patch by ghbcode).
  - There's a new action which allows creating local imports from a
  global import (use *Ctrl+1* on top of global import name).
   -

   It's now possible to change the default interpreter through an action
   (default binding: *Ctrl+Shift+Alt+I*).
   - The interactive console now has scroll lock (patch by bongibong).

About PyDev

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development, now also available for Python on Visual Studio Code.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

It is also available as a standalone through LiClipse with goodies such as
multiple cursors, theming and support for many other languages, such as
Django Templates, Jinja2, Html, JavaScript, etc.

Links:

PyDev: http://pydev.org
PyDev Blog: http://pydev.blogspot.com
PyDev on VSCode: http://pydev.org/vscode
LiClipse: http://www.liclipse.com
PyVmMonitor - Python Profiler: http://www.pyvmmonitor.com/

Cheers,

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


Re: Why list.reverse() modifies the list, but name.replace() does not modify the string?

2018-09-03 Thread Chris Angelico
On Tue, Sep 4, 2018 at 3:49 AM, C W  wrote:
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
>> L = [3, 6, 1,4]
>> L.reverse()
>> L
> [4, 1, 6, 3]
> This changes the original list.
>
> Example 2:
>> name = "John Smith"
>> name.replace("J", j")
>> name
> 'John Smith'
> This does not change the original string.
>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?

A very fair question.

Firstly, strings are immutable. Once you have a string, nothing can
ever change it. Lists, on the other hand, can change (you can append
to them, remove elements, etc, etc). So reversing a string in-place is
impossible, but it's an option for the list.

Secondly, you get a clue from the return values.

>>> L = [3, 6, 1,4]
>>> L.reverse()
>>> L
[4, 1, 6, 3]
>>> name = "John Smith"
>>> name.replace("J", "j")
'john Smith'
>>> name
'John Smith'

Notice how name.replace() returns the new string, but L.reverse()
doesn't return anything? (Technically it returns None, but that's used
as a signal meaning "I got nuffin, govna!".) That's a strong clue; if
something sounds like it ought to make a change, but it returns None,
it's almost certainly changed the object in-place.

If you like, you can iterate backwards over the list, rather than
actually reversing it:

for number in reversed(L): ...

And you can use a very convenient, if a little obscure, syntax to
create a reversed copy of the list:

>>> L
[4, 1, 6, 3]
>>> L[::-1]
[3, 6, 1, 4]

(So you can assign that to another name, or whatever.) This is called
"slicing" the list, if you want to look it up in the docs.

Ultimately, your question comes down to the difference between mutable
and immutable types. Definitely something worth learning more about,
and definitely worth asking these sorts of questions about.

Thanks for asking! :)

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


Re: Anaconda with Python 3.7

2018-09-03 Thread Alex Kaye
Sorry bad typing.  AK


On Mon, Sep 3, 2018 at 7:07 AM Alex Kaye  wrote:

> When one downloads Anaconda, doesn't it
> bring Pyhon with it ?
>
> AK
>
> On Mon, Sep 3, 2018 at 6:13 AM Thomas Jollans  wrote:
>
>> On 2018-09-03 11:38, gvim wrote:
>> > Anyone have any idea when Anaconda might ship a version compatible with
>> > Python 3.7. I sent them 2 emails but no reply.
>> >
>> > gvim
>>
>> You can install Python 3.7 in a conda environment right now. Most
>> packages (certainly all the ones I use) appear to be available for
>> Python 3.7 at least on Windows and Linux already.
>>
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


PEP 8001 -- Python Governance Voting Process

2018-09-03 Thread Mark Lawrence
I believe that this https://www.python.org/dev/peps/pep-8001/ may be of 
interest.


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

Mark Lawrence

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


Re: Why list.reverse() modifies the list, but name.replace() does not modify the string?

2018-09-03 Thread Mark Lawrence

On 03/09/18 18:49, C W wrote:

Hello all,

I am learning the basics of Python. How do I know when a method modifies
the original object, when it does not. I have to exmaples:
Example 1:

L = [3, 6, 1,4]
L.reverse()
L

[4, 1, 6, 3]
This changes the original list.


Lists are mutable, i.e. can be changed, so it makes sense to do this 
change in place.




Example 2:

name = "John Smith"
name.replace("J", j")
name

'John Smith'
This does not change the original string.


Strings are immutable, i.e. cannot be changed, so you have to create a 
new string.  Your call to `replace` will do just that, but as it's not 
saved `name` remains the same.  You could use


name = name.replace("J", j") or

newname = name.replace("J", j") as you see fit.



Why the two examples produce different results? As a beginner, I find this
confusing. How do you do it?

Thank you!




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

Mark Lawrence

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


Re: Anaconda with Python 3.7

2018-09-03 Thread Alex Kaye
When one downloads Anaconda, doesn't it
bring Pyhon with it ?

AK

On Mon, Sep 3, 2018 at 6:13 AM Thomas Jollans  wrote:

> On 2018-09-03 11:38, gvim wrote:
> > Anyone have any idea when Anaconda might ship a version compatible with
> > Python 3.7. I sent them 2 emails but no reply.
> >
> > gvim
>
> You can install Python 3.7 in a conda environment right now. Most
> packages (certainly all the ones I use) appear to be available for
> Python 3.7 at least on Windows and Linux already.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why list.reverse() modifies the list, but name.replace() does not modify the string?

2018-09-03 Thread Mike C
Yes, I forgot that strings are immutable. I can't change anything in the 
string. Silly me!

Thank you very much, I appreciate it. I guess sometimes it just take an 
outsider to take you outside the box. And all is answered. :)


From: Python-list  on behalf 
of Mark Lawrence 
Sent: Monday, September 3, 2018 2:21:36 PM
To: python-list@python.org
Subject: Re: Why list.reverse() modifies the list, but name.replace() does not 
modify the string?

On 03/09/18 18:49, C W wrote:
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
>> L = [3, 6, 1,4]
>> L.reverse()
>> L
> [4, 1, 6, 3]
> This changes the original list.

Lists are mutable, i.e. can be changed, so it makes sense to do this
change in place.

>
> Example 2:
>> name = "John Smith"
>> name.replace("J", j")
>> name
> 'John Smith'
> This does not change the original string.

Strings are immutable, i.e. cannot be changed, so you have to create a
new string.  Your call to `replace` will do just that, but as it's not
saved `name` remains the same.  You could use

name = name.replace("J", j") or

newname = name.replace("J", j") as you see fit.

>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?
>
> Thank you!
>


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

Mark Lawrence

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


Re: Cross platform mutex to prevent script running more than instance?

2018-09-03 Thread Cameron Simpson

On 03Sep2018 07:45, Malcolm Greene  wrote:

Use case: Want to prevent 2+ instances of a script from running ...
ideally in a cross platform manner. I've been researching this topic and
am surprised how complicated this capability appears to be and how the
diverse the solution set is. I've seen solutions ranging from using
directories, named temporary files,  named sockets/pipes, etc. Is there
any consensus on best practice here?


I like os.mkdir of a known directory name. This tends to be atomic and 
forbidden when the name already exists, on all UNIX platforms, over remote 
filesystems. And, I expect, likewise on Windows.


All the other modes like opening files O_EXCL etc tend to be platform specific 
and not reliable over network filesystems.


And pid based approaches don't work cross machine, if that is an issue.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list