[Tutor] pip install of subprocess module

2017-09-18 Thread Derek Smith
Hi All,

Thank for the recent replies.  I want to use the subprocess.run module b/c per 
the docs os.system is antiquated and cannot use  more than 1 arg in 3.6.
Why am I doing wrong below?  Also couldn't I just copy and paste the subprocess 
code from github and create a file, but then how do I tell python this is a new 
module called os.system since this py file requires os.system and os.spawn*
I am on AIX 7.1, python 3.6.2, pip 9.0.1

Thx agn!

# pip install git+https://github.com/python/cpython/blob/3.6/Lib/subprocess.py 
-vvv
Collecting git+https://github.com/python/cpython/blob/3.6/Lib/subprocess.py
  Cloning https://github.com/python/cpython/blob/3.6/Lib/subprocess.py to 
/tmp/pip-bw8rryo9-build
  Running command git clone -q 
https://github.com/python/cpython/blob/3.6/Lib/subprocess.py 
/tmp/pip-bw8rryo9-build
remote: Not Found
fatal: repository 
'https://github.com/python/cpython/blob/3.6/Lib/subprocess.py/' not found
Cleaning up...
Command "git clone -q 
https://github.com/python/cpython/blob/3.6/Lib/subprocess.py 
/tmp/pip-bw8rryo9-build" failed with error code 128 in None
Exception information:
Traceback (most recent call last):
  File "/opt/freeware/lib/python3.6/site-packages/pip/basecommand.py", line 
215, in main
status = self.run(options, args)
  File "/opt/freeware/lib/python3.6/site-packages/pip/commands/install.py", 
line 335, in run
wb.build(autobuilding=True)
  File "/opt/freeware/lib/python3.6/site-packages/pip/wheel.py", line 749, in 
build
self.requirement_set.prepare_files(self.finder)
  File "/opt/freeware/lib/python3.6/site-packages/pip/req/req_set.py", line 
380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
  File "/opt/freeware/lib/python3.6/site-packages/pip/req/req_set.py", line 
620, in _prepare_file
session=self.session, hashes=hashes)
  File "/opt/freeware/lib/python3.6/site-packages/pip/download.py", line 805, 
in unpack_url
unpack_vcs_link(link, location)
  File "/opt/freeware/lib/python3.6/site-packages/pip/download.py", line 479, 
in unpack_vcs_link
vcs_backend.unpack(location)
  File "/opt/freeware/lib/python3.6/site-packages/pip/vcs/__init__.py", line 
286, in unpack
self.obtain(location)
  File "/opt/freeware/lib/python3.6/site-packages/pip/vcs/git.py", line 142, in 
obtain
self.run_command(['clone', '-q', url, dest])
  File "/opt/freeware/lib/python3.6/site-packages/pip/vcs/__init__.py", line 
325, in run_command
spinner)
  File "/opt/freeware/lib/python3.6/site-packages/pip/utils/__init__.py", line 
707, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "git clone -q 
https://github.com/python/cpython/blob/3.6/Lib/subprocess.py 
/tmp/pip-bw8rryo9-build" failed with error code 128 in None



Derek Smith  |  Unix/TSM Administrator  | Racksquared Data Centers
::  dereksm...@racksquared.com  *: 
www.racksquared.com |  
www.racksquared.jobs

[cid:image003.png@01D2E9AA.1B9CF8F0]

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] pip install of subprocess module

2017-09-18 Thread Alan Gauld via Tutor
On 18/09/17 18:59, Derek Smith wrote:

> I want to use the subprocess.run module b/c per the> docs os.system is 
> antiquated

Its not so much antiquated but it is deprecated because
it is severely limited, all you get back is an error code.

> Why am I doing wrong below?  

You are trying to install it, but subprocess is part
of the standard library, it should already be installoed.

Just use the >>> prompt and try

>>> import subprocess

If you don't get an error then its already there.

> python this is a new module called os.system 

subprocess is its own moduile it is not part of os.

import os
import subprocess

> since this py file requires os.system and os.spawn*

Both of those can be replaced by calls within
subprocess but  they will not be called by
those names. Read the subprocess module documents
carefully they give example code for replacing
these functions.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor