Re: n00b question on spacing

2013-06-21 Thread Ray Cote
- Original Message -

> From: "Yves S. Garret" 
> To: [email protected]
> Sent: Friday, June 21, 2013 5:17:28 PM
> Subject: n00b question on spacing

> Hi, I have a question about breaking up really long lines of code in
> Python.

> I have the following line of code:
> log.msg("Item wrote to MongoDB database %s/%s"
> %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']),
> level=log.DEBUG, spider=spider)

> Given the fact that it goes off very far to the right on my screen is
> not terribly
> pleasing to my eyes (and can be rude for other developers).

> I was thinking of splitting it up like so:
> log.msg("Item wrote to MongoDB database %s/%s"
> %(settings['MONGODB_DB'], settings['MONGODB_COLLECTION']),
> level=log.DEBUG, spider=spider)

> Is this ok? Are there any rules in Python when it comes to breaking
> up long lines of
> code?

> --
> http://mail.python.org/mailman/listinfo/python-list

Hi Yves: 
PEP8 is your definitive guide for style questions: 
<http://www.python.org/dev/peps/pep-0008/> 

and this is an interesting set of notes: 
<http://stackoverflow.com/questions/5931297/how-would-you-properly-break-this-line-to-match-pep8-rules>
 

Basic rule is to break within parenthesis -- after that it becomes a matter of 
personal taste/style. 

In your specific example, I would do something like: 
log.msg( 
"Item wrote to MongoDB database %s %s" % ( 
settings['MONGODB_DB'], 
settings['MONGODB_COLLECTION]), 
level=log.DEBUG, 
spider=spider) 

Though you might want to: 
a) start your string right after the log.msg( 
b) put more than one settings on the same line 
c) put the last two parameters on the same line. 

I find that once I start breaking up lines for length, that I prefer to break 
up everything. 

Also remember when entering long lines of text that strings concatenate within 
parenthesis. 
So, 
("a, b, c" 
"d, e, f" 
"g, h, i") 

Is the same as ("a, b, cd, e, fg, h, i") 

--Ray 

-- 

Ray Cote, President 
Appropriate Solutions, Inc. 
We Build Software 
603.924.6079 
-- 
http://mail.python.org/mailman/listinfo/python-list


Missing something obvious with python-requests

2013-01-03 Thread Ray Cote
Hello List:

I seem to be missing something obvious in terms of using proxies with the 
requests module. 
I'm using requests 1.4 and Python 2.7. Have tried this on Centos 6 and Windows 
XP.

Here's the sample code, right out of the manual:

import requests

proxies = {
'https': '192.168.24.25:8443',
'http': '192.168.24.25:8443', }

a = requests.get('http://google.com/', proxies=proxies)


When I look at the proxy log, I see a GET being performed -- when it should be 
a CONNECT. 
Does not matter if I try to get http or https google.com. 
Clearly I'm missing something fundamental here. 
But after two days of fiddling with the code and tracing through requests I'm 
still unclear as to why requests is not using the proxy information.

Any help (or slap on the side of the head) appreciated. 
Thanks
--Ray

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


Re: Missing something obvious with python-requests

2013-01-03 Thread Ray Cote
Thank you.
--Ray


- Original Message -
From: "Barry Scott" 
To: "Ray Cote" 
Cc: [email protected]
Sent: Thursday, January 3, 2013 5:48:52 PM
Subject: Re: Missing something obvious with python-requests

The shipped python library code does not work.

See http://bugs.python.org/issue7291 for patches.

Barry

On 3 Jan 2013, at 18:53, Ray Cote  wrote:

> Hello List:
> 
> I seem to be missing something obvious in terms of using proxies with the 
> requests module. 
> I'm using requests 1.4 and Python 2.7. Have tried this on Centos 6 and 
> Windows XP.
> 
> Here's the sample code, right out of the manual:
> 
> import requests
> 
> proxies = {
>'https': '192.168.24.25:8443',
>'http': '192.168.24.25:8443', }
> 
> a = requests.get('http://google.com/', proxies=proxies)
> 
> 
> When I look at the proxy log, I see a GET being performed -- when it should 
> be a CONNECT. 
> Does not matter if I try to get http or https google.com. 
> Clearly I'm missing something fundamental here. 
> But after two days of fiddling with the code and tracing through requests I'm 
> still unclear as to why requests is not using the proxy information.
> 
> Any help (or slap on the side of the head) appreciated. 
> Thanks
> --Ray
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


-- 
Ray Cote, President
Appropriate Solutions, Inc.
We Build Software
603.924.6079
-- 
http://mail.python.org/mailman/listinfo/python-list


Recommended pypi caching proxy?

2017-12-18 Thread Ray Cote
Hello list:

Looking to deploy a locally cached pypi proxy service.

Is there a recommended/preferred pypi caching tool?
I’ve found:
  - proxypypy
  - Flask-Pypi-Proxy
  - pypicache

All of which seem to have generally the same functionality and all of which
are a few years old.
Recommendations from the crowd?
—Ray


-- 
Raymond Cote, President
Tokenize What Matters®
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommended pypi caching proxy?

2017-12-18 Thread Ray Cote
On Mon, Dec 18, 2017 at 1:00 PM, Matt Wheeler  wrote:

> On Mon, 18 Dec 2017, 15:45 Ray Cote, 
> wrote:
>
>> Looking to deploy a locally cached pypi proxy service.
>>
>> Is there a recommended/preferred pypi caching tool?
>> I’ve found:
>>   - proxypypy
>>   - Flask-Pypi-Proxy
>>   - pypicache
>>
>> All of which seem to have generally the same functionality and all of
>> which
>> are a few years old.
>> Recommendations from the crowd?
>>
>
> In the past I've used https://github.com/devpi/devpi
> It may have many features you don't need if all you're after is a caching
> proxy, but I found it does that well and it appears to still be pretty
> active.
>
>> --
>
> --
> Matt Wheeler
> http://funkyh.at
>

Thanks for the recommendation.
Will take a look at it.
—Ray


-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Ray Cote
On Fri, Jan 27, 2017 at 4:18 PM, mm0fmf  wrote:

> On 27/01/2017 20:17, bob gailer wrote:
>
>> On 1/25/2017 9:25 PM, Sandeep Nagar wrote:
>>
>>> Hi,
>>>
>>> A few month ago I wrote a book on introductory python based on my
>>> experinces while teaching python to Bachelor students of engineering.
>>> It is now available in e-book and paperback format at Amazon.
>>>
>>> https://www.amazon.com/dp/1520153686
>>>
>>> The book is written for beginners of python programming language and
>>> written in learn-by-doing manner. If some group members can review the
>>> same, it will be useful for myself to come up with an improved version.
>>>
>> Who is the publisher of this book?
>>
>> I just took a look at the pages that can be viewed on Amazon. Many
>> reactions. it is hard for me to write this, as it seems it would sound
>> harsh, judgemental, unappreciative. But you did ask for a review, and
>> this is my honest reaction.
>>
>> I find it hard to read a book written by a non-native speaker of
>> English. I an constantly having to overlook what to me are spelling,
>> grammatical and vocabulary errors. I HIGHLY recommend you find an editor
>> who can fix these errors.
>>
>> Snap. I found it impossible to read and never got to the Python parts. It
> is not written in English. Most of the pronouns and conjunctions are
> missing. It looks like it has not been proof-read as words loose
> capitalisation, many are mis-spelt and grammar rules regarding plural cases
> and agreement are just ignored.
>
>
In addition to what other’s have said:
- congrats on taking the time to write a book and put it out for others.
- Introduction to Python section 2.1 starts with C example. Seems out of
place.
- Search inside the book has 0 results for iterator -- how do you do Python
without iterators?
- Two references to generator, but they are random number generator
references.
- Was confused by the switching in and out of numpy usage.
- And yes, Python3 is the way to go. Been writing Python since 1.5 and
about 90% of my new code is Python 3.5.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pylint woes

2016-05-07 Thread Ray Cote
On Sat, May 7, 2016 at 2:52 PM, Christopher Reimer <
[email protected]> wrote:

> On 5/7/2016 9:51 AM, DFS wrote:
>
>> Has anyone ever in history gotten 10/10 from pylint for a non-trivial
>> program?
>>
>
> I routinely get 10/10 for my code. While pylint isn't perfect and
> idiosyncratic at times, it's a useful tool to help break bad programming
> habits.
>

I’m impressed with 10/10.
My approach is to ensure flake8 (a combination of pyflakes and pep8
checking) does not report any warnings and then run pyLint as a final
check.
Code usually ends up in the 9.0 to 9.5 range, sometimes a bit higher.
Also find it useful to add some additional short names we use to the
 allowed names list.

Biggest issue I have with pyLint is that it complains when function
parameters are indented twice vs. once. pyFlakes likes the twice.
Example:
def function_name(
parm_1,
long_parm_name,
….
end_of_long_list_of params)
parm_1 = long_parm_name

—Ray




-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: advice needed for simple python web app

2005-02-04 Thread Ray Cote
At 8:51 AM -0800 2/4/05, Paul Rubin wrote:
"Dan Perl" <[EMAIL PROTECTED]> writes:
 This matches pretty much what I've decided to do.  I'll start with cgi and
 CGIHTTPServer because I'll learn more from that and then move to a
 framework, quite likely CherryPy, although by that time I may change my
 choice.  Philip Greenspun's book looks good and I'll have to go through it.
 Thanks for the advice.
You might also look at the docs for HTML::Mason (www.masonhq.com) to
get a look at a reasonably mature template system, even if you don't
plan to use it (because it's in Perl and not Python).
There's a Python port of HTML::Mason called Myghty.
A fairly new project. I've just played around with it a bit
Well worth a look:  
--
Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Database recommendations for Windows app

2005-06-22 Thread Ray Cote
At 3:14 PM +0100 6/22/05, Will McGugan wrote:
>Hi,
>
>I'd like to write a windows app that accesses a locally stored database.
>There are a number of tables, the largest of which has 455,905 records.
>
>Can anyone recommend a database that runs on Windows, is fast /
>efficient and can be shipped without restrictions or extra downloads?
>
>I have googled and found plenty of information on databases, its just
>that I dont have enough experience with databases to know which one is
>best for my task!
>
>
>Thanks in advance,
>
>Will McGugan

We use Firebird  for that.

--Ray
-- 

Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: web programming with mod_python

2005-07-02 Thread Ray Cote
At 7:17 PM -0300 7/1/05, Rodrigo Dominguez wrote:
>My question is: is there some kind of framework that works with mod_python?

You could take a look at Myghty:



-- 

Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Daemon strategy

2016-02-05 Thread Ray Cote
We’ve recently stopped building Windows services (Python or any other type)
and started using the NSSM service manager.
Takes a normal Windows application and runs it as a service.
The NSSM service manager provides great command-line support for
installing, configuring, and controlling Windows services.
Has greatly reduced our development time and test time since we no longer
need to test both app and service executables.



Downside is that it is a separate tool to install.
Upside is that it has features such as :
  - run-once at startup.
  - auto-restart failed services
  - setting service dependences (don’t start until another service is up
and running)
  - set processor dependencies

—Ray


On Fri, Feb 5, 2016 at 1:39 PM,  wrote:

> It appears that python-deamon would be exactly what I need. Alas,
> appears not to run on Windows. If I am wrong about that, please tell
> me.
>
> To what tools should I turn?
>
> I am not eager to produce a "service" on Windows unless it cannot be
> avoided.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-17 Thread Ray Cote
On Wed, Feb 17, 2016 at 3:54 PM, Rob Gaddi <
[email protected]> wrote:

> > It seems Python is used more for web based applications. Is it equally
> fine for creating stand-alone *.exe's? Can the same code be compiled to run
> on Linux or Android or web-based?
>
> Standalone EXEs are hit and miss.  I've had best luck deploying just as
> Python scripts to machines with an expectation that the environment is
> already configured (i.e. Python already installed).
>
> You don't compile, you interpret.  So long as you've got the
> interpreter on the target platform you're set.  The EXE tools out there
> do so by bundling your plain-text source up with the interpreter
> environment.
>
> Packaging/distribution remains one of the real pain points in Python.
>

Python is used for much more then web based applications.
The latest versions of pyInstaller (http://www.pyinstaller.org) are
incredibly good at generating single-file binaries for both Windows and
Linux.
We’re using pyInstaller to distribute applications based on some fairly
complex frameworks—including wxPython (http://www.wxpython.org)
which is one option for building GUI applications.

—Ray




-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Looking for examples of using aiopg with aiohttp and non-async startup.

2016-02-25 Thread Ray Cote
Hello:

I have an aiohttp project that starts in the usual way:

app = web.Application()
app.router.add_route(‘POST”, ‘/‘, handler)
web.run_app(app)

My question is, how do I work with an aiopg.pool with aiohttp?
There only seems to be async interfaces into aiopg — but I don’t want to
create the pool in my handler since that requires a connection on each
transaction.

I found one example that was
  app[“db”] = await aiopg.create_pool(dsn)
but that doesn’t seen correct since we’re not yet in a loop.

Can someone please provide an example showing the proper way to integrate
aiopg pool into an aiohttp web application?

Regards
—Ray

-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Looking for examples of using aiopg with aiohttp and non-async startup.

2016-02-26 Thread Ray Cote
Answer (obvious after a refreshing sleep):
Just run a separate async pool connection prior to kicking off the aiohttp
web application.
The startup now looks like:

async def connect():
return await aiopg.create_pool(…)

if __name__ == “__main__”:
loop = asyncio.get_event_loop()
pool = loop.run_until_complete(connect())
app = web.Application()
app["pool"] = pool
app.router.add_route(‘POST', '/pv/v1/', handle_v1)
web.run_app(app)


Then, in the handle_v1 code:
pool = request.app["pool"]
connection = await pool.acquire()
cursor = await connection.cursor()
—r

On Thu, Feb 25, 2016 at 5:23 PM, Ray Cote 
wrote:

> Hello:
>
> I have an aiohttp project that starts in the usual way:
>
> app = web.Application()
> app.router.add_route(‘POST”, ‘/‘, handler)
> web.run_app(app)
>
> My question is, how do I work with an aiopg.pool with aiohttp?
> There only seems to be async interfaces into aiopg — but I don’t want to
> create the pool in my handler since that requires a connection on each
> transaction.
>
> I found one example that was
>   app[“db”] = await aiopg.create_pool(dsn)
> but that doesn’t seen correct since we’re not yet in a loop.
>
> Can someone please provide an example showing the proper way to integrate
> aiopg pool into an aiohttp web application?
>
> Regards
> —Ray
>
> --
> Raymond Cote, President
> voice: +1.603.924.6079 email: [email protected] skype:
> ray.cote
>
>
>


-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Adding run_in_executor task to already existing loop.

2016-03-25 Thread Ray Cote
Hello:

I’m trying to perform an synchronous task while using asyncio.
I understand the solution is to use run_in_executor.
I’m not clear on how to add this into an already running event loop.

I’ve found lots of examples showing how to set up a loop and run this, but
I’m blocked in regards to doing this when the loop is already established.


Example code:

def blocking_func(param1):
# call the blocking call here.
return results

async def process_request():
loop = asyncio.get_event_loop()
block = loop.run_in_executor(None, blocking_func, “hello”)
results = await loop.run_until_complete(asyncio.gather(*[block, ])

The above code says “loop already running.” because we’re already in an
async ask that has been awaited. What is the proper method of adding in
this new synchronous task?

Regards
—Ray
-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Adding run_in_executor task to already existing loop.

2016-03-25 Thread Ray Cote
On Fri, Mar 25, 2016 at 5:00 PM, Zachary Ware  wrote:

> I'm assuming you're doing `await process_request()` elsewhere, which
> is what's producing your error: you're trying to start the loop within
> a coroutine running on that loop.  loop.run_in_executor() returns a
> Future just like any other coroutine, so process_request just needs
> this:
>
>async def process_request():
>loop = asyncio.get_event_loop()
>results = await loop.run_in_executor(None, blocking_func, 'hello')
>

Yes, that was precisely the directive I needed. This is now working
perfectly.
Thanks
—Ray



-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: inheriting a large python code base

2014-02-15 Thread Ray Cote
Hi Rita:

Some personal thoughts on how I've approached similar situations:


Step 0: Put all that code under version control immediately. 
Being able to track and back-out changes is extremely useful -- even in a 
small, single-coder app. 
With something this big, you'll find "things suddenly stopped working" as you 
make changes, and
being able to back-track your changes is invaluatable. 


Step 2: Ask, "Why do you want to optimize the code (run faster)?"
  - what is slow?
- starting?
- loading data?
- solving specific problem?
- running specific functionality?
- specific calculations?
- network access?
- database access?
- small data sets?
- large data sets?
  - who says it is slow? 
and what is their definition of sufficiently quick?


3: You state you do not understand the internal logic. 
I've also inherited applications where the internal logic was unclear. 
Writing unit and functional tests (if they do not exist) will help to ensure 
you do not change the behavior of the application. 

You may find that understanding the internal logic is the best way to speed-up 
the application. 
You'll likely find that the biggest speed improvements come from optimizing the 
logic -- not the Python.


4: This is a personal prefernce when inheriting large code chunks -- and I'm 
sure some will counter it is not optimum. 
Go through the code and run pep8 and pyflakes (or flake8) on all the code and 
address the issues that come up. 
Aside from bringing the code into styling conformance, I find that this helps 
me to familiarize myself with the code. 
As you're making style changes, review individual functions and add 
documentation if it is missing. 
If you're not clear what a function does, mark it as such so you know to look 
at it carefully in the future. 


5: Now you have a clean set of code -- most of which you've at least visually 
scanned -- and you're 
ready to create some timing tests and dig into specifics.

--Ray


- Original Message -
From: "Rita" 
To: [email protected]
Sent: Saturday, February 15, 2014 12:10:33 PM
Subject: inheriting a large python code base



hi all, 


i just inherited a large python code base and I would like to optimize the code 
(run faster). The application is a scientific application so I really don't 
understand the internal logic. 


Here is what I have done so far, profile (cProfile) and was able to see where 
the code was taking the longest time. 



I was wondering if anyone else experienced something like this and how they 
overcame a problem such a this…what techniques have you used to "optimize" the 
code. 






-- 
--- Get your facts first, then you can distort them as you please. -- 
-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
Ray Cote, President
Appropriate Solutions, Inc.
We Build Software
603.924.6079
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python performance

2013-08-02 Thread Ray Cote
- Original Message -
> From: "Schneider" 
> To: [email protected]
> Sent: Friday, August 2, 2013 8:00:09 AM
> Subject: Python performance
> 
> Hi list,
> 
> I have to write a small SMTP-Relay script (+ some statistic infos)
> and
> I'm wondering, if this
> can be done in python (in terms of performance, of course not in
> terms
> of possibility ;) ).
> 
> It has to handle around 2000 mails per hour for at least 8hours a day
> (which does not mean, that it is allowed not to respond the rest of
> the day.
> 

A quick calculation shows that 2,000 mails per hour is less than 1 email every 
second. 
Plenty of time to handle individual emails.


> Can this be done? or should I better use some other programming
> language?
> My second choice would be erlang.
> 
> bg,
> Johannes
> 
> 
> --
> GLOBE Development GmbH
> Königsberger Strasse 260
> 48157 MünsterGLOBE Development GmbH
> Königsber
> ger Strasse 260
> 48157 Münster
> 0251/5205 390
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 

-- 
Ray Cote, President
Appropriate Solutions, Inc.
We Build Software
603.924.6079
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A little test for you Guys😜

2015-09-22 Thread Ray Cote
On Tue, Sep 22, 2015 at 7:32 PM, Mark Lawrence 
wrote:

>
>> 2 Lists
>>
>
> Tut, tut, tut.


That is not a list, that is a tutple.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Firebird and Python

2006-02-27 Thread Ray Cote
At 5:07 PM +0100 2/27/06, Magnus Lycka wrote:
>
>  I'm still interested
>in experiences from Pythonistas using Firebird--
>especially embedded.

Works great.
Python and Firebird embedded (at least on Windows) is very simple to use.
Not currently using it on other platforms.
--Ray

-- 

Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Crawler - Python or Perl?

2008-06-09 Thread Ray Cote

At 11:21 AM -0700 6/9/08, subeen wrote:

On Jun 10, 12:15 am, Stefan Behnel <[EMAIL PROTECTED]> wrote:

 subeen wrote:
 > can use urllib2 module and/or beautiful soup for developing crawler

 Not if you care about a) speed and/or b) memory efficiency.


 > http://blog.ianbicking.org/2008/03/30/python-html-parser-performance/


 Stefan


ya, beautiful soup is slower. so it's better to use urllib2 for
fetching data and regular expressions for parsing data.


regards,
Subeen.
http://love-python.blogspot.com/
--
http://mail.python.org/mailman/listinfo/python-list


Beautiful Soup is a bit slower, but it will actually parse some of 
the bizarre HTML you'll download off the web. We've written a couple 
of crawlers to run over specific clients sites (I note, we did _not_ 
create the content on these sites).


Expect to find html code that looks like this:







[from a real example, and yes, it did indeed render in IE.]

I don't know if some of the quicker parsers discussed require 
well-formed HTML since I've not used them. You may want to consider 
using one of the quicker HTML parsers and, when they throw a fit on 
the downloaded HTML, drop back to Beautiful Soup -- which usually 
gets _something_ useful off the page.


--Ray

--

Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.5 adoption

2008-04-19 Thread Ray Cote
At 12:16 PM -0700 4/18/08, Joseph Turian wrote:
>Basically, we're planning on releasing it as open-source, and don't
>want to alienate a large percentage of potential users.
>--
>http://mail.python.org/mailman/listinfo/python-list

A few seconds after reading this, I read the announcement for pyspread.
Requirements? Python 2.5.

You might want to talk with the pyspread folks regarding their 
decision to require 2.5.
http://pyspread.sourceforge.net

--Ray

-- 

Raymond Cote
Appropriate Solutions, Inc.
PO Box 458 ~ Peterborough, NH 03458-0458
Phone: 603.924.6079 ~ Fax: 603.924.8668
rgacote(at)AppropriateSolutions.com
www.AppropriateSolutions.com
-- 
http://mail.python.org/mailman/listinfo/python-list


python3.5m vs libpython3.5m on CentOS6

2017-02-24 Thread Ray Cote
Hello:

Attempting to install latest psycopg2 (2.6.2) on current CentOS6 with a
custom install Python3.5.

Getting the error:
/usr/bin/ld: cannot find -lpython3.5m

Don’t have a python3.5m library on the system.
Do have libpython3.5m.so.1.0 with a soft link to libpython3.5m.so.

Thought adding a new python3.5m.so softlink to  libpython3.5m.so.1.0 and
re-running ldconfig would do the trick, but still get the same error.

Any hints appreciated.
—Ray
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3.6 printing crashing on OS X 10.12.4

2017-04-05 Thread Ray Cote
Hello:

Python 3.6 crashing when trying to print from the environment.

$ python
Python 3.6.1 (default, Mar 22 2017, 15:53:21)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello")

Python(53390,0x7fffdd9e63c0) malloc: *** error for object 0x10dde4110:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6


Pastebin link to OS X crash report if that’s helpful:
https://pastebin.com/t1j3nz5L


1: Python installed via ports.
2: OS X 10.12.4.
3: Python 3.6.1 (though I also had this problem with 3.6.0).
4: Have successfully run python 3.5 for months.
5: Running under standard terminal program.
6: I have py36-readline installed.
7: Have tried uninstalling and re-installing Python.

Any thoughts on what I could have wrong?

Regards
—Ray
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 printing crashing on OS X 10.12.4

2017-04-10 Thread Ray Cote
On Wed, Apr 5, 2017 at 3:40 PM, Python  wrote:

> Le 05/04/2017 à 20:14, Ray Cote a écrit :
>
>> Hello:
>>
>> Python 3.6 crashing when trying to print from the environment.
>>
>> $ python
>> Python 3.6.1 (default, Mar 22 2017, 15:53:21)
>> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>> print("hello")
>>>>>
>>>>
>> Python(53390,0x7fffdd9e63c0) malloc: *** error for object 0x10dde4110:
>> pointer being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>> Abort trap: 6
>>
>>
>> Pastebin link to OS X crash report if that’s helpful:
>> https://pastebin.com/t1j3nz5L
>>
>>
>> 1: Python installed via ports.
>> 2: OS X 10.12.4.
>> 3: Python 3.6.1 (though I also had this problem with 3.6.0).
>> 4: Have successfully run python 3.5 for months.
>> 5: Running under standard terminal program.
>> 6: I have py36-readline installed.
>> 7: Have tried uninstalling and re-installing Python.
>>
>> Any thoughts on what I could have wrong?
>>
>> Regards
>> —Ray
>>
>>
> Mac OS X 10.12.3, Python 3 installed by brew
>
> mac:~$ uname -r
> 16.4.0
> mac:~$ python3
> Python 3.6.0 (default, Mar  4 2017, 12:32:34)
> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print("hello")
> hello
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


Follow up:

Never did find out why the macports Python was crashing.
Switched over to brew and it is working fine.
—R
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New to python and programming

2017-05-17 Thread Ray Cote
On Wed, May 17, 2017 at 4:43 PM, justin walters 
wrote:

> On Wed, May 17, 2017 at 12:59 PM, BT  wrote:
>
> > Hi guys,
> > I am fairly new to programming. I was just trying to understand how this
> > group works. Am i allowed to ask any questions that I may have when i get
> > stuck? I mean is this group for new programmers as well..?
> > Thanks
>
> You might want to check out the Python Tutors list:
   https://mail.python.org/mailman/listinfo/tutor

It is friendly towards beginner questions.
—Ray
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ciphers in SSL library python.

2017-06-14 Thread Ray Cote
1: Are you 100% sure the server to which you are trying to connect supports
RC4-SHA?

2: If you have access to the server, turn on SSH debug mode to watch your
client try and connect.
I find that to be helpful in debugging many connection issues.


On Wed, Jun 14, 2017 at 4:16 PM,  wrote:

> Hey, I want to use RC4-SHA in python, but when I try to use it, it doesn't
> get used (If I do cipher() it says none(and handshake fails too)), I've
> tried to modify the SSL library, but it didn't help at all(Maybe I did
> something wrong, any help will be appreciated). Is there a way to use the
> RC4-SHA cipher(0x05). Please, I need help, I've been looking for an answer
> for days.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ciphers in SSL library python.

2017-06-14 Thread Ray Cote
On Wed, Jun 14, 2017 at 4:40 PM,  wrote:

> Hey, I'm "the server(I've written using ssl/socket)" and my client is
> using RC4-SHA, but I can't make the server to use it. I make "
> ciphers='RC4-SHA' " in the ssl.wrap_socket. Do I need to modify SSL file or
> something to make it work?


Had not realized you were the server.

Been a long time since I used SSL, but here’s a few thoughts.
1: What version of Python are you using?
2: What version of OpenSSL are you using? RC4-SHA is considered insecure
and might be disabled at the OpenSSL/OS level.
3: You say you set ciphers=. I found some old code that used the
set_ciphers context call. That might be the approach.
—R


-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: API Help

2017-06-14 Thread Ray Cote
On Wed, Jun 14, 2017 at 4:33 PM, Bradley Cooper  wrote:

> I am working with an API and I get a return response in this format.
>
>
> [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"
> UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","
> quantityAvailable":0.0},{"warehouseCode":"TX-1-US","
> quantityAvailable":14.0},{"warehouseCode":"CA-1-US","
> quantityAvailable":4.0},{"warehouseCode":"AB-1-CA","
> quantityAvailable":1.0},{"warehouseCode":"WA-1-US","
> quantityAvailable":0.0},{"warehouseCode":"PO-1-CA","
> quantityAvailable":0.0}]}]
>
> What is the best way to read through the data?
>

Definitely JSON:
>>>
json.loads(“""[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},{"warehouseCode":"TX-1-US","quantityAvailable":14.0},{"warehouseCode":"CA-1-US","quantityAvailable":4.0},{"warehouseCode":"AB-1-CA","quantityAvailable":1.0},{"warehouseCode":"WA-1-US","quantityAvailable":0.0},{"warehouseCode":"PO-1-CA","quantityAvailable":0.0}]}]""")

[{u’itemNumber': u'75-5044', u'inventory': [{u'quantityAvailable': 0.0,
u'warehouseCode': u'UT-1-US'}, {u'quantityAvailable': 0.0,
u'warehouseCode': u'KY-1-US'}, {u'quantityAvailable': 14.0,
u'warehouseCode': u'TX-1-US'}, {u'quantityAvailable': 4.0,
u'warehouseCode': u'CA-1-US'}, {u'quantityAvailable': 1.0,
u'warehouseCode': u'AB-1-CA'}, {u'quantityAvailable': 0.0,
u'warehouseCode': u'WA-1-US'}, {u'quantityAvailable': 0.0,
u'warehouseCode': u'PO-1-CA'}]}]
>>>

-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: API Help

2017-06-14 Thread Ray Cote
On Wed, Jun 14, 2017 at 6:14 PM, Erik  wrote:

> On 14/06/17 22:54, Ray Cote wrote:
>
>> Definitely JSON:
>>
>>>
>>>>> json.loads(“""[{"itemNumber":"75-5044","inventory":[{"wareho
>> useCode":"UT-1-US","quantityAvailable":0.0},{"wa
>> rehouseCode":"KY-1-US","quantityAvailable":0.0},
>> {"warehouseCode":"TX-1-US","quantityAvailable":14.00
>> 000},{"warehouseCode":"CA-1-US","quantityAvailable":4.
>> 0},{"warehouseCode":"AB-1-CA","quantityAvailable":
>> 1.0},{"warehouseCode":"WA-1-US","quantityAvailab
>> le":0.0},{"warehouseCode":"PO-1-CA","quantityAva
>> ilable":0.0}]}]""")
>>
>> [{u’itemNumber': u'75-5044', u'inventory': [{u'quantityAvailable': 0.0,
>> u'warehouseCode': u'UT-1-US'}, {u'quantityAvailable': 0.0,
>> u'warehouseCode': u'KY-1-US'}, {u'quantityAvailable': 14.0,
>> u'warehouseCode': u'TX-1-US'}, {u'quantityAvailable': 4.0,
>> u'warehouseCode': u'CA-1-US'}, {u'quantityAvailable': 1.0,
>> u'warehouseCode': u'AB-1-CA'}, {u'quantityAvailable': 0.0,
>> u'warehouseCode': u'WA-1-US'}, {u'quantityAvailable': 0.0,
>> u'warehouseCode': u'PO-1-CA'}]}]
>>
>>>
>>>>>
> If that makes it definitely JSON, then this makes it definitely Python ;) :
>
> >>> [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-
> 1-US","quantityAvailable":0.0},{"warehouseCode
> ":"KY-1-US","quantityAvailable":0.0},{"warehouse
> Code":"TX-1-US","quantityAvailable":14.0},{"ware
> houseCode":"CA-1-US","quantityAvailable":4.0},{"
> warehouseCode":"AB-1-CA","quantityAvailable":1.0
> },{"warehouseCode":"WA-1-US","quantityAvailable":0.0
> },{"warehouseCode":"PO-1-CA","quantityAvailable":0.0}]}]
> [{'itemNumber': '75-5044', 'inventory': [{'quantityAvailable': 0.0,
> 'warehouseCode': 'UT-1-US'}, {'quantityAvailable': 0.0, 'warehouseCode':
> 'KY-1-US'}, {'quantityAvailable': 14.0, 'warehouseCode': 'TX-1-US'},
> {'quantityAvailable': 4.0, 'warehouseCode': 'CA-1-US'},
> {'quantityAvailable': 1.0, 'warehouseCode': 'AB-1-CA'},
> {'quantityAvailable': 0.0, 'warehouseCode': 'WA-1-US'},
> {'quantityAvailable': 0.0, 'warehouseCode': 'PO-1-CA'}]}]
>
>
>
> So, I think we're agreed that it's definitely one or the other.
>

Well, that is the Python output from the json.loads() call; so yes…


-- 
Raymond Cote, President
voice: +1.603.924.6079 email: [email protected] skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list