Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Steve Petrie, P.Eng.

Chris,

Thanks for your response -- much appreciated.

Please see my remarks embedded below.

- Original Message - 
From: "Chris Angelico" <ros...@gmail.com>

To: "Steve Petrie, P.Eng." <apet...@aspetrie.net>
Cc: <python-list@python.org>
Sent: Saturday, January 23, 2016 10:14 AM
Subject: Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with 
"Permission denied" error (Python 2.7.11 on Win XP SP3);




On Fri, Jan 22, 2016 at 3:40 AM, Steve Petrie, P.Eng.
<apet...@aspetrie.net> wrote:
In both failure cases, it looks to me like there is a bug in the pip 
logic,
that is using a *nix forward slash "/" instead of a double backslash 
"\\"

before the file name "make.bat".


I'm not sure what your exact problem is, but I can say that it isn't
this; the Unix-style forward slash is perfectly legal under Windows
(and it's even legal to mix and match).

ChrisA


I never knew that the forward slash is legal under Windows -- thanks for 
the tip :)


After further research, I got mitmproxy installed under Windows XP. Now 
mitmdump starts ok (with one "warning").


* * *
* * *

In case other Windows XP "orphans" want to use mitmdump, here's what I 
learned (via Google):


1. There was a bug in pip-8.0.0 (bug fixed recently in pip-8.0.2) that 
caused the "Permission denied" error:


I did another upgrade of pip, and this time the upgrade installed 
pip-8.0.2 (instead of pip-8.0.0).


And pip-8.0.2 successfully installed mitmproxy.

2. But then mitmdump wouldn't start (can't use mitmproxy under 
Windows -- there's no GUI port):


  C:\Documents and Settings\SteveP>mitmdump --help
  failed to create process.

This "failed to create process" problem, was caused by whitespace, in 
the pathname to the python directory, in the bang line in file 
mitmdump-script.py:


I changed the bang line (wrapping the pathname in double quotes) in file 
mitmdump-script.py:


  from: #!e:\a p p s\python27\python.exe
 to: #!"e:\a p p s\python27\python.exe"

and now mitmdump starts ok with one warning:

  C:\Documents and Settings\SteveP>mitmdump --help
  e:\a p p 
s\python27\lib\site-packages\watchdog\observers\__init__.py:89: 
UserWarning: Failed to import read_directory_changes. Fall back to 
polling.
warnings.warn("Failed to import read_directory_changes. Fall back 
to polling.")

  usage: mitmdump-script.py [options] [filter]
  ...

I tried to fix the warning, but so far no success (due to my Python 
ignorance).


However, mitmdump does start (with the same warning) and it creates an 
empty output file:


  C:\Documents and Settings\SteveP>mitmdump -w mitmdump_20160123.txt
  e:\a p p 
s\python27\lib\site-packages\watchdog\observers\__init__.py:89: 
UserWarning: Failed to import read_directory_changes. Fall back to 
polling.
warnings.warn("Failed to import read_directory_changes. Fall back 
to polling.")


I haven't yet got mitmdump to actually write anything to the output 
file, but I expect that's just a matter of studying the mitmdump docs.


* * *
* * *

Thanks again for the response.

Best Regards,

Steve

P.S. Be assured -- I will soon be moving away from Windows XP to a new 
computer running Debian Linux.



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


Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-24 Thread Steve Petrie, P.Eng.
- Original Message - 
From: "Chris Angelico" <ros...@gmail.com>

To: "Steve Petrie, P.Eng." <apet...@aspetrie.net>
Cc: <python-list@python.org>
Sent: Saturday, January 23, 2016 2:56 PM
Subject: Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with 
"Permission denied" error (Python 2.7.11 on Win XP SP3);



In case other Windows XP "orphans" want to use mitmdump, here's what 
I

learned (via Google):

I changed the bang line (wrapping the pathname in double quotes) in 
file

mitmdump-script.py:

  from: #!e:\a p p s\python27\python.exe
 to: #!"e:\a p p s\python27\python.exe"


Spaces in names are often a pain. I'd raise this upstream as a bug
report - it should be fixed properly rather than depending on manual
editing.



I'd like to raise the bug report you suggest, but I'm not clear on the 
meaning of the word "upstream" in relation to Python-list. (I've seen 
"upstream" used by participants in another forum 
<pgsql-gene...@postgresql.org> and always wondered what "upstream" meant 
there.)


I know what "upstream" means, in terms of: water flow in a river, or 
vehicle flow on a highway, or data flow over a comms link. "upstream" is 
where a moving particle was, earlier in time


But my puzzlement is -- where is "upstream" in relation to an email 
forum, in the context of a thread?


The fix for the mitmdump bang line bug was applied to file 
mitmdump-script.py, and according to its "Date Modified" field on my Win 
XP, this file arrived in the e:\a p p s\Python27\Scripts\ directory, 
when I installed mitmproxy. So it looks to me like file 
mitmdump-script.py is a product of the mitmproxy project.


Am I correct in assuming, that "upstream" in the context of this present 
thread, means I should report the bang line bug to an mitmproxy forum?


Steve

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


pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-23 Thread Steve Petrie, P.Eng.

Greetings To Python-list,

I'm trying to install Python package:

  mitmproxy (https://mitmproxy.org/)

on Windows XP SP3.

I'm a complete Python newbie. Not planning to do any Python programming 
at this time. Just trying to get package mitmproxy working (or at least 
the mitmdump component, since "There is no interactive user interface on 
Windows." per:


  http://docs.mitmproxy.org/en/stable/install.html

* * *
* * *

I have installed Python that announces itself on the Python command line 
as:


  Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC 
v.1500 32 bit (Intel)] on win32


* * *
* * *

I'm using the following command in a Win XP cmd.exe shell (not the 
Python shell) to install mitmproxy:


  pip install mitmproxy

The first install attempt failed, ending with some diagnostics displayed 
in the Win XP cmd.exe shell window:


  C:\Documents and Settings\SteveP>pip install mitmproxy
  Collecting mitmproxy
Downloading mitmproxy-0.15.tar.gz (1.7MB)
  100% || 1.7MB 4.5kB/s
  ...

Collecting Pillow<3.1,>=3.0.0 (from mitmproxy)
 Downloading Pillow-3.0.0-cp27-none-win32.whl (1.2MB)
   100% || 1.2MB 6.1kB/s
  Collecting pyperclip<1.6,>=1.5.22 (from mitmproxy)
Downloading pyperclip-1.5.26.zip
  Exception:
  Traceback (most recent call last):
File "e:\a p p s\python27\lib\site-packages\pip\basecommand.py", 
line 211, in main

  status = self.run(options, args)
File "e:\a p p 
s\python27\lib\site-packages\pip\commands\install.py", line 294, in run

  requirement_set.prepare_files(finder)
File "e:\a p p s\python27\lib\site-packages\pip\req\req_set.py", 
line 334, in prepare_files

  functools.partial(self._prepare_file, finder))
File "e:\a p p s\python27\lib\site-packages\pip\req\req_set.py", 
line 321, in _walk_req_to_install

  more_reqs = handler(req_to_install)
File "e:\a p p s\python27\lib\site-packages\pip\req\req_set.py", 
line 491, in _prepare_file

  session=self.session)
File "e:\a p p s\python27\lib\site-packages\pip\download.py", line 
825, in unpack_url

  session,
File "e:\a p p s\python27\lib\site-packages\pip\download.py", line 
677, in unpack_http_url

  unpack_file(from_path, location, content_type, link)
File "e:\a p p s\python27\lib\site-packages\pip\utils\__init__.py", 
line 645,in unpack_file

  flatten=not filename.endswith('.whl')
File "e:\a p p s\python27\lib\site-packages\pip\utils\__init__.py", 
line 546,in unzip_file

  fp = open(fn, 'wb')
  IOError: [Errno 13] Permission denied: 
'c:\\docume~1\\stevep\\locals~1\\temp\\pip-buildpnnfyf\\pyperclip\\docs/make.bat'

  You are using pip version 7.1.2, however version 8.0.0 is available.
  You should consider upgrading via the 'python -m pip 
install --upgrade pip' command.


  C:\Documents and Settings\SteveP>

* * *
* * *

I  upgraded pip to version 8.0.0:

  C:\Documents and Settings\SteveP>python -m pip install --upgrade pip
  Collecting pip
Downloading pip-8.0.0-py2.py3-none-any.whl (1.2MB)
  100% || 1.2MB 9.1kB/s
  Installing collected packages: pip
Found existing installation: pip 7.1.2
  Uninstalling pip-7.1.2:
Successfully uninstalled pip-7.1.2
  Successfully installed pip-8.0.0

* * *
* * *

I tried again to install mitmproxy, and the installation got a little 
further, but failed again on a similar error, on a different file 
(watchdog-0.8.3.tar.gz instead of pyperclip-1.5.26.zip):


  C:\Documents and Settings\SteveP>pip install mitmproxy

  C:\Documents and Settings\SteveP>pip install mitmproxy
  e:\a p p s\python27\lib\site-packages\pip\pep425tags.py:89: 
RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may 
be incorrect

warn=(impl == 'cp')):
  e:\a p p s\python27\lib\site-packages\pip\pep425tags.py:93: 
RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag 
may be incorrect

warn=(impl == 'cp')):
  e:\a p p s\python27\lib\site-packages\pip\pep425tags.py:99: 
RuntimeWarning: Config variable 'Py_UNICODE_SIZE' is unset, Python ABI 
tag may be incorrect

sys.version_info < (3, 3))) \
  Collecting mitmproxy
Using cached mitmproxy-0.15.tar.gz
  Collecting six<1.11,>=1.10.0 (from mitmproxy)
Using cached six-1.10.0-py2.py3-none-any.whl
  ...

  Collecting pyperclip<1.6,>=1.5.22 (from mitmproxy)
Using cached pyperclip-1.5.26.zip
  Collecting pydivert>=0.0.7 (from mitmproxy)
Downloading pydivert-0.0.7.zip
  Collecting watchdog<0.9,>=0.8.3 (from mitmproxy)
Downloading watchdog-0.8.3.tar.gz (83kB)
  100% || 86kB 6.8kB/s
  Exception:
  Traceback (most recent call last):
File "e:\a p p s\python27\lib\site-packages\pip\basecommand.py", 
line 209, in main

  status = self.run(options, args)
File "e:\a p p 
s\python27\lib\site-packages\pip\commands\install.py", line 299, in run

  

Re: Need Pattern For Logging Into A Website

2013-01-25 Thread Steve Petrie
On Thursday, January 24, 2013 8:29:51 PM UTC-5, Tim Daneliuk wrote:
 I need to write a Python script to do the following:
 
 
 
- Connect to a URL and accept any certificate - self-signed or 
 authoritative
 
- Provide login name/password credentials
 
- Fill in some presented fields
 
- Hit a Submit button
 
 
 
 Why?  Because I don't want to have to start a browser and do this
 
 interactively every time I authenticate with a particular server.
 
 I want to do this at the command line with no interactive intervention.
 
 
 
 I know Python pretty well.  I don't quite know how to do this and
 
 was hoping someone had a simple pattern they could share for
 
 doing this.
 
 
 
 TIA,
 
 -- 
 
 
 
 Tim Daneliuk tun...@tundraware.com
 
 PGP Key: http://www.tundraware.com/PGP/

The mechanize module (http://wwwsearch.sourceforge.net/mechanize/) might be a 
place to start.  I've done something similar with code like this:

response = mechanize.urlopen(login_form_url)
forms = mechanize.ParseResponse(response, backwards_compat=False)
response.close()
form = forms[0]   # might be more than one, though
  # fill the form
form.set_value(username, name='userName')
form.set_value(password, name='password')
  # set headers - user-agent, etc.
login_request = form.click()
login_response = mechanize.urlopen(login_request)
login_response_content = login_response.read()
...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Suitable software stacks for simple python web service

2012-11-24 Thread Steve Petrie
On Thursday, November 22, 2012 1:42:42 AM UTC-5, Kev Dwyer wrote:
 Steve Petrie wrote:
 
 
 
  On Wednesday, November 21, 2012 2:32:40 AM UTC-5, Kev Dwyer wrote:
 
  Hello List,
 
  
 
  
 
  
 
  I have to build a simple web service which will:
 
  
 
  
 
  
 
   - receive queries from our other servers
 
  
 
   - forward the requests to a third party SOAP service
 
  
 
   - process the response from the third party
 
  
 
   - send the result back to the original requester
 
  
 
  
 
  
 
  From the point of view of the requester, this will happen within the
 
  scope
 
  
 
  of a single request.
 
  
 
  
 
  
 
  The data exchanged with the original requester will likely be encoded as
 
  
 
  JSON; the SOAP service will be handled by SUDS.
 
  
 
  
 
  
 
  The load is likely to be quite light, say a few requests per hour, though
 
  
 
  this may increase in the future.
 
  
 
  
 
  
 
  Given these requirements, what do you think might be a suitable software
 
  
 
  stack, i.e. webserver and web framework (if a web framework is even
 
  
 
  necessary)?
 
  
 
  
 
  
 
  Candidates should be compatible with Python2.7, though I'd be happy to
 
  
 
  consider Python 3 if anyone knows of a Python3 SOAP library that has good
 
  
 
  WSDL support.
 
  
 
  
 
  
 
  Cheers,
 
  
 
  
 
  
 
  Kev
 
  
 
  I'm using the Bottle web framework (http://bottlepy.org) to integrate
 
  requests and replies originating in a Drupal site, a Beanstream (payment
 
  processor) account, and a Salesforce instance.
 
  
 
  Communication with Salesforce is done through the Salesforce Python
 
  Toolkit (http://code.google.com/p/salesforce-python-toolkit/), which uses
 
  Suds.
 
  
 
  Communication with the Drupal site uses Python's (and PHP's on the Drupal
 
  side) native JSON support.
 
  
 
  This is under Python 2.6.8 and Apache 2.2.23 running on an AWS EC2
 
  instance.
 
  
 
  No (major) problems so far, though still in the early stages of this
 
  project.
 
  
 
  Steve
 
  
 
  
 
  
 
  I chose Bottle after trying a few other frameworks because, well, I can't
 
  remember exactly why, though thinking back it's probably because of the
 
  clarity of Bottle's approach and the simplicity of the documentation.
 
 
 
 
 
 Hello Steve,
 
 
 
 Thanks for  your comment.
 
 
 
 I'm curious, did you consider any web servers other than Apache? 
 
 
 
 Kev

You're telling me that there are other web servers? ;)

I didn't try any others seriously, no.  My experience is with Apache and IIS, 
and I try to stay away from Windows.

I should mention, given Dieter Maurer's comment, that Bottle is a (fairly thin) 
layer built over WSGI.  I've built applications directly over WSGI as well; 
that's another way to go, it's quite straightforward.  mod_python is no longer 
supported: 
http://blog.dscpl.com.au/2010/05/modpython-project-soon-to-be-officially.html.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Suitable software stacks for simple python web service

2012-11-21 Thread Steve Petrie
On Wednesday, November 21, 2012 2:32:40 AM UTC-5, Kev Dwyer wrote:
 Hello List,
 
 
 
 I have to build a simple web service which will:
 
 
 
  - receive queries from our other servers
 
  - forward the requests to a third party SOAP service
 
  - process the response from the third party
 
  - send the result back to the original requester
 
 
 
 From the point of view of the requester, this will happen within the scope 
 
 of a single request.  
 
 
 
 The data exchanged with the original requester will likely be encoded as 
 
 JSON; the SOAP service will be handled by SUDS.
 
 
 
 The load is likely to be quite light, say a few requests per hour, though 
 
 this may increase in the future.
 
 
 
 Given these requirements, what do you think might be a suitable software 
 
 stack, i.e. webserver and web framework (if a web framework is even 
 
 necessary)?  
 
 
 
 Candidates should be compatible with Python2.7, though I'd be happy to 
 
 consider Python 3 if anyone knows of a Python3 SOAP library that has good 
 
 WSDL support.
 
 
 
 Cheers,
 
 
 
 Kev

I'm using the Bottle web framework (http://bottlepy.org) to integrate requests 
and replies originating in a Drupal site, a Beanstream (payment processor) 
account, and a Salesforce instance.

Communication with Salesforce is done through the Salesforce Python Toolkit 
(http://code.google.com/p/salesforce-python-toolkit/), which uses Suds.

Communication with the Drupal site uses Python's (and PHP's on the Drupal side) 
native JSON support.

This is under Python 2.6.8 and Apache 2.2.23 running on an AWS EC2 instance.

No (major) problems so far, though still in the early stages of this project.

Steve



I chose Bottle after trying a few other frameworks because, well, I can't 
remember exactly why, though thinking back it's probably because of the clarity 
of Bottle's approach and the simplicity of the documentation.
-- 
http://mail.python.org/mailman/listinfo/python-list