Writing a module to abstract a REST api

2015-09-17 Thread Joseph L. Casale
I need to write a module to abstract the RabbitMQ HTTP REST api. Before I do this, I would like to see how other projects have done similar in the hopes I make something consistent and generic etc. Does anyone regularly work with a library that abstracts a REST API and can recommend it for

Re: Writing a module to abstract a REST api

2015-09-17 Thread Joseph L. Casale
> If I understand you: > http://www.python-requests.org/en/latest/ > > is an example of what you are looking for? > > It's great. > > Also check out > http://cramer.io/2014/05/20/mocking-requests-with-responses/ > > if you need to mock requests. Hi Laura, The twitter samples Jon sent were

Attaching to python process in alternate windows session

2015-08-26 Thread Joseph L. Casale
A while ago I stumbled on a workaround for this, but forgot. Anyone know the trick to accomplish this? Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

[issue24921] Operator precedence table in 5.15 should be highest to lowest precedence

2015-08-24 Thread Joseph Schachner
New submission from Joseph Schachner: We should not make people who need to read Python documentation do an extra transformation in their heads to correctly understand that in section 5.15 higher precedence is at the bottom of the table and lower precedence is at the top. Because

RE: return types from library api wrappers

2015-08-17 Thread Joseph L. Casale
Current practice is a NamedTuple for python code or the C equivalent. I forget the C name, but I believe it is used by os.stat Hi Terry, Ok, that is what I will go with. Thanks for the confirmation, jlc -- https://mail.python.org/mailman/listinfo/python-list

return types from library api wrappers

2015-08-16 Thread Joseph L. Casale
What's the accepted practice for return types from a c based API Python wrapper? I have many methods which return generators which yield potentially many fields per iteration. In lower level languages we would yield a struct with readonly fields. The existing implementation returns a dict which I

Module load times

2015-08-13 Thread Joseph L. Casale
I have an auto generated module that provides functions exported from a c dll. Its rather large and we are considering some dynamic code generation and caching, however before I embark on that I want to test import times. As the module is all auto generated through XSL, things like __all__ are

Re: Module load times

2015-08-13 Thread Joseph L. Casale
Hi Stefan, How is the DLL binding implemented? Using ctypes? Or something else? It is through ctypes. Obviously, instantiating a large ctypes wrapper will take some time. A binary module would certainly be quicker here, both in terms of import time and execution time. Since you're

RE: Module load times

2015-08-13 Thread Joseph L. Casale
Importing is not the same as instantiation. When you import a module, the code is only read from disk and instantiated the first time. Then it is cached. Subsequent imports in the same Python session use the cached version. I do mean imported, in the original design there were many ctype

[issue24808] PyTypeObject fields have incorrectly documented types

2015-08-06 Thread Joseph Weston
New submission from Joseph Weston: Several fields in the Python 3.x documentation for the PyTypeObject API have incorrectly documented types. This was probably due to a wholesale shift of documentation from Python 2.x. -- assignee: docs@python components: Documentation files

Re: Hi

2015-07-26 Thread Joseph Wayodi
On Sat, Jul 25, 2015 at 8:30 AM, 김지훈 coolji1...@gmail.com wrote: Hi. I recently changed my path to be a programmer so I decided to learn python. I downloaded files(Python 2.7.10 - 2015-05-23) to setup on your website. (also got the version of x64 because of my cpu) But when I try to install

RE: Need assistance

2015-07-18 Thread Joseph Lee
Hi Laura, There are edge cases where this may fail (and let's see if Craig catches this on his own). Cheers, Joseph -Original Message- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail@python.org] On Behalf Of Laura Creighton Sent: Saturday, July 18, 2015 5:16 AM

RE: Need assistance

2015-07-16 Thread Joseph Lee
fuction. But isn't it imperative that I have the index of the spaces in the string name? I use the Fullname.isspace function. JL: No. Michael's hint lets you turn a string into a list. Good luck. Cheers, Joseph -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org

RE: Need assistance

2015-07-16 Thread Joseph Lee
Hi Michael, I have talked to this guy offlist (basically you gave him the answer (smiles)). Cheers, Joseph -Original Message- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail@python.org] On Behalf Of Michael Torrie Sent: Thursday, July 16, 2015 7:41 PM To: python

RE: Writing a python editor for blind developers

2015-07-06 Thread Joseph Lee
powered by QT 5 is accessible). There exists a list like this for blind Pythoneers at: http://www.freelists.org/list/pythonvis For more info on NVDA, go to: http://www.nvaccess.org P.S. A very short intro: I'm Joseph, a blind Pythoneer and regular code and translations contributor to NonVisual

Callbacks with concurrent.futures

2015-03-12 Thread Joseph L. Casale
I have a ProcessPoolExecutor for which I am attaching multiple callbacks. As this must be process based and not thread based, I don't have the luxury communication between threads. Without a queue, does something inherent exist in concurrent futures that allows me to accumulate some data from the

Re: Callbacks with concurrent.futures

2015-03-12 Thread Joseph L. Casale
ProcessPoolExecutor is built on the multiprocessing module, so I expect you should be able to use multiprocessing.Queue or multiprocessing.Pipe in place of threading.Queue. Hi Ian, Yeah I am using a Manager.Queue as the method polling the queue is itself in a process. I just wondered if there

Re: Did https://pypi.python.org/pypi/ became huge and slow?

2015-03-10 Thread Joseph Wayodi
://pypi.python.org/pypi/. Does it make sense that https://pypi.python.org/pypi and https://pypi.python.org/pypi/ are completely different pages? The only difference in URLs being the slash at the end. Joseph. -- https://mail.python.org/mailman/listinfo/python-list

Hashed lookups for tabular data

2015-01-19 Thread Joseph L. Casale
I have some tabular data for example 3 tuples that I need to build a container for where lookups into any one of the three fields are O(1). Does something in the base library exist, or if not is there an efficient implementation of such a container that has been implemented before I give it a go?

Re: Hashed lookups for tabular data

2015-01-19 Thread Joseph L. Casale
So presumably your data's small enough to fit into memory, right? If it isn't, going back to the database every time would be the best option. But if it is, can you simply keep three dictionaries in sync? Hi Chris, Yeah the data can fit in memory and hence the desire to avoid a trip here.

Re: Hashed lookups for tabular data

2015-01-19 Thread Joseph L. Casale
Why not take a look at pandas as see if there's anything there you could use? Excellent docs here http://pandas.pydata.org/pandas-docs/stable/ and the mailing list is available at gmane.comp.python.pydata amongst other places. Mark, Actually it was the first thing that came to mind. I did

Re: Hashed lookups for tabular data

2015-01-19 Thread Joseph L. Casale
If you want an sql-like interface, you can simply create an in-memory sqlite3 database. import sqlite3 db = sqlite3.Connection(':memory:') You can create indexes as you need, and query using SQL. Later, if you find the data getting too big to fit in memory, you can switch to using an

Re: Hashed lookups for tabular data

2015-01-19 Thread Joseph L. Casale
The IDs of the objects prove that they're actually all the same object. The memory requirement for this is just what the dictionaries themselves require; their keys and values are all shared with other usage. Chris, I would have never imagined that, much appreciated for that! jlc --

Argparse defaults

2015-01-04 Thread Joseph L. Casale
Does a facility exist to add an argument with a default being a function that leverages the final parsed Namespace? For example: group = parser.add_argument_group(' some_group ') group.add_argument( '--some_group', nargs='*', type=str )

ORM opinion

2014-12-04 Thread Joseph L. Casale
Begrudgingly, I need to migrate away from SQLAlchemy onto a package that has fast imports and very fast model build times. I have a less than ideal application that uses Python as a plugin interpreter which is not performant in this use case where its being invoked freshly several times per

RE: ORM opinion

2014-12-04 Thread Joseph L. Casale
First recommendation: Less layers. Instead of SQLAlchemy, just import sqlite3 and use it directly. You should be able to switch out import sqlite as db for import psycopg2 as db or any other Python DB API module, and still have most/all of the benefit of the extra layer, without any extra

RE: ORM opinion

2014-12-04 Thread Joseph L. Casale
Anything listed here http://www.pythoncentral.io/sqlalchemy-vs-orms/ you've not heard about? I found peewee easy to use although I've clearly no idea if it suits your needs. There's only one way to find out :) Hi Mark, I found that article before posting and some of the guys here have

[issue22934] Python/importlib.h is now generated by Programs/_freeze_importlib.c, change comment

2014-11-24 Thread joseph
New submission from joseph: Since the changeset 91853:88a532a31eb3 _freeze_importlib.c resides in the Programs dir. The header comment of Python/importlib.h should be changed to reflect this. -- components: Build files: freeze_importlib_comment.patch keywords: patch messages: 231617

RE: Using map()

2014-11-16 Thread Joseph L. Casale
I checked my modules with pylint and saw the following warning: W: 25,29: Used builtin function 'map' (bad-builtin) Why is the use of map() discouraged? It' such a useful thing. The warning manifests from the opinion that a comprehension is more suitable. You can disable the warning or you

[issue22872] multiprocessing.Queue raises AssertionError

2014-11-14 Thread Joseph Siddall
New submission from Joseph Siddall: putting something in Queue(multiprocessing.Queue) after closing it raises an AssertionError. Getting something out of a Queue after closing it raises an OSError. I expected both scenarios to raise the same exception. To Reproduce: from multiprocessing

support for boost::python for build double object

2014-11-03 Thread Joseph Shen
In the boost::python library there is a function boost::python::long_ and this function return a boost::python::object variable I'm trying to wrap a double variale but I can't find something just like boost::python::double_ can someone help me to build a double object PS. I know there

Re: support for boost::python for build double object

2014-11-03 Thread Joseph Shen
On Monday, November 3, 2014 10:11:01 PM UTC+8, Skip Montanaro wrote: On Mon, Nov 3, 2014 at 7:53 AM, Joseph Shen joseph...@gmail.com wrote: In the boost::python library there is a function boost::python::long_ and this function return a boost::python::object variable I'm

Processing xml for output with cElementTree

2014-10-17 Thread Joseph L. Casale
I am unfortunately unable to use lxml for a project and must resort to base only libraries to create several nested elements located directly under a root element. The caveat is the incremental writing and flushing of the nested elements as they are created. So assuming the structure is

Re: Python vs C++

2014-08-24 Thread Joseph Martinot-Lagarde
Le 23/08/2014 16:21, Chris Angelico a écrit : On Sun, Aug 24, 2014 at 12:02 AM, Ian Kelly ian.g.ke...@gmail.com wrote: I don't know how fast lilypond is, but perhaps one could write an editor that wraps lilypond and invokes it in realtime to show the output in an adjacent panel, perhaps with a

Re: Python vs C++

2014-08-22 Thread Joseph Martinot-Lagarde
Le 22/08/2014 02:26, Chris Angelico a écrit : On Fri, Aug 22, 2014 at 4:05 AM, Joseph Martinot-Lagarde joseph.martinot-laga...@m4x.org wrote: For information, Cython works with C++ now: http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html. Now isn't that cool! Every time Cython gets

Re: Python vs C++

2014-08-21 Thread Joseph Martinot-Lagarde
a number of features that belong in higher level languages; but if you want those sorts of features, why not just grab Python or Pike or something and save yourself the trouble? For information, Cython works with C++ now: http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html. Joseph

RE: GIL detector

2014-08-17 Thread Joseph L. Casale
I don't have to care about threading issues all the time and can otherwise freely choose the right model of parallelism that suits my current use case when the need arises (and threads are rarely the right model). I'm sure that's not just me. The sound bite of a loyal Python coder:) If it

[issue21091] EmailMessage.is_attachment should be a method

2014-08-04 Thread Joseph Godbehere
Joseph Godbehere added the comment: Patch to change message.is_attachment from a property to a normal method. I've updated the doc and all calls to is_attachment. -- keywords: +patch nosy: +joegod Added file: http://bugs.python.org/file36243/attach_not_property.patch

[issue21091] EmailMessage.is_attachment should be a method

2014-08-04 Thread Joseph Godbehere
Joseph Godbehere added the comment: Very good point, Serhiy. Here is an alternative patch, which instead changes Message.is_multipart from a method to a property as per your suggestion. This way incorrect usage should fail noisily. This patch is against the relevant docs, tests, is_multipart

RE: Using pyVmomi

2014-07-24 Thread Joseph L. Casale
You could: - have a single point of entry that can check and, if necessary, revalidate - create a helper that checks and, if necessary, revalidate, which is then called where ever needed - create a decorator that does the above for each function that needs it Hi Ethan,

Using pyVmomi

2014-07-23 Thread Joseph L. Casale
I am doing some scripting with pyVmomi under 2.6.8 so the code may run directly on a vmware esxi server. As the code is long running, it surpasses the authentication timeout. For anyone familiar with this code and/or this style of programming, does anyone have a recommendation for an elegant

[issue21713] a mistype comment in PC/pyconfig.h

2014-06-10 Thread Joseph Shen
New submission from Joseph Shen: in the source file PC/pyconfig.h at line 393 there is a mistype this is the origin file == /* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version number of 1200. Microsoft eMbedded

Re: IDE for python

2014-06-03 Thread Joseph Martinot-Lagarde
Le 28/05/2014 13:31, Sameer Rathoud a écrit : I was searching for spyder, but didn't got any helpful installable. What problem did you encounter while trying to install spyder ? Spyder is oriented towards scientific applications, but can be used as a general python IDE. I use it for GUI

RE: compiled cx_freeze

2014-05-25 Thread Joseph L. Casale
Anyone knows where to get a compiled cx_freeze that has already has this patch? http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze -- https://mail.python.org/mailman/listinfo/python-list

RE: compiled cx_freeze

2014-05-25 Thread Joseph L. Casale
Unfortunately, this is buggy too. Here is a test output from a compiled console exe created with the above version of cx freeze: Let Christoph know, he is very responsive and extremely helpful. -- https://mail.python.org/mailman/listinfo/python-list

RE: Exception problem with module

2014-05-19 Thread Joseph L. Casale
Well I am not sure what advantage this has for the user, not my code as I don't advocate the import to begin with it, its fine spelled as it was from where it was... The advantage for the user is: /snip Hey Steven, Sorry for the late reply (travelling). My comment wasn't clear, I was

Re: Problem building 3.5 on Windows

2014-05-17 Thread Joseph L. Casale
Mark, Excuse the format of this post, stuck on the road only with an iPhone but in the event it helps, http://blog.vrplumber.com/b/2014/02/12/step-2-get-amd64-compatible-vs-2010/ may be useful. Jlc -- https://mail.python.org/mailman/listinfo/python-list

RE: Exception problem with module

2014-05-14 Thread Joseph L. Casale
I see that you've solved your immediate problem, but you shouldn't call __setattr__ directly. That should actually be written setattr(bar, 'a_new_name', MyError) But really, since bar is (apparently) a module, and it is *bar itself* setting the attribute, the better way is

Exception problem with module

2014-05-13 Thread Joseph L. Casale
I am working with a module that I am seeing some odd behavior. A module.foo builds a custom exception, module.foo.MyError, its done right afaict. Another module, module.bar imports this and calls bar.__setattr__('a_new_name', MyError). Now, not in all but in some cases when I catch a_new_name,

RE: Exception problem with module

2014-05-13 Thread Joseph L. Casale
Best would be to print out what's in a_new_name to see if it really is what you think it is. If you think it is what you think it is, have a look at its __mro__ (method resolution order, it's an attribute of every class), to see what it's really inheriting. That should show you what's

Re: How can this assert() ever trigger?

2014-05-13 Thread Joseph Martinot-Lagarde
Le 13/05/2014 11:56, Albert van der Horst a écrit : In article mailman.9917.1399914607.18130.python-l...@python.org, Joseph Martinot-Lagarde joseph.martinot-laga...@m4x.org wrote: Le 10/05/2014 17:24, Albert van der Horst a écrit : I have the following code for calculating the determinant

Re: NumPy, SciPy, Python 3X Installation/compatibility issues

2014-05-12 Thread Joseph Martinot-Lagarde
Le 10/05/2014 19:07, esaw...@gmail.com a écrit : Hi All-- Let me state at the start that I am new to Python. I am moving away from Fortran and Matlab to Python and I use all different types of numerical and statistical recipes in my work. I have been reading about NumPy and SciPy and could

Re: How can this assert() ever trigger?

2014-05-12 Thread Joseph Martinot-Lagarde
Le 10/05/2014 17:24, Albert van der Horst a écrit : I have the following code for calculating the determinant of a matrix. It works inasfar that it gives the same result as an octave program on a same matrix. / def determinant(

Re: The “does Python have variables?” debate

2014-05-08 Thread Joseph Martinot-Lagarde
Le 08/05/2014 02:35, Ben Finney a écrit : Marko Rauhamaa ma...@pacujo.net writes: Ben Finney b...@benfinney.id.au: That's why I always try to say “Python doesn't have variables the way you might know from many other languages”, Please elaborate. To me, Python variables are like variables

RE: Designing a network in Python

2014-04-30 Thread Joseph L. Casale
I have managed to read most of the important data in the xml onto lists. Now, I have two lists, Source and Destination and I'd like to create bi-directional links between them. And moreover, I'd like to assign some kind of a bandwidth capacity to the links and similarly, storage and

RE: Designing a network in Python

2014-04-30 Thread Joseph L. Casale
I don't know how to do that stuff in python. Basically, I'm trying to pull certain data from the xml file like the node-name, source, destination and the capacity. Since, I am done with that part, I now want to have a link between source and destination and assign capacity to it. I dont

RE: Soap list and soap users on this list

2014-04-28 Thread Joseph L. Casale
https://gist.github.com/plq/11384113 Unfortunately, you need the latest Spyne from https://github.com/arskom/spyne, this doesn't work with 2.10 2.11 is due around end of may, beginning of june. Ping back if you got any other questions. Burak, Thanks a ton! I've just pulled this down

RE: Executing pl/sql script File in python without sqlclient

2014-04-25 Thread Joseph L. Casale
Is there a way to execute pl/sql Script files through Python without sqlclient. https://code.google.com/p/pypyodbc/ might work for you... i have checked cx_oracle and i guess it requires oracle client, so is there a way to execute without oracle client. Right, as the name implies it uses

Soap list and soap users on this list

2014-04-17 Thread Joseph L. Casale
Seems the soap list is a little quiet and the moderator is mia regardless. Are there many soap users on this list familiar with Spyne or does anyone know the most optimal place to post such questions? Thanks! jlc -- https://mail.python.org/mailman/listinfo/python-list

RE: Soap list and soap users on this list

2014-04-17 Thread Joseph L. Casale
Is your question regarding anything at all Python, or are you just looking for helpful nerds? :) Hi Chris, Thanks for responding. I've been looking at Spyne to produce a service that can accept a request formatted as follows: ?xml version='1.0' encoding='UTF-8'? SOAP-ENV:Envelope

RE: Soap list and soap users on this list

2014-04-17 Thread Joseph L. Casale
Read first. You can try : http://spyne.io/docs/2.10/ https://pythonhosted.org/Soapbox/ Thanks Marcus, I assure you I have been reading but missed soapbox, I'll keep hacking away, thanks for the pointer. jlc -- https://mail.python.org/mailman/listinfo/python-list

RE: writing reading from a csv or txt file

2014-03-30 Thread Joseph L. Casale
Hi I have 3 csv files with a list of 5 items in each. rainfall in mm, duration time,time of day,wind speed, date. I am trying to compare the files. cutting out items in list list. ie:- first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date. first file

Implement multiprocessing without inheriting parent file handle

2014-03-21 Thread Antony Joseph
Hi all, How can i implement multiprocessing without inherit file descriptors from my parent process? Please help me. regards, Antony -- https://mail.python.org/mailman/listinfo/python-list

asyncio question

2014-03-13 Thread Joseph L. Casale
I have a portion of code I need to speed up, there are 3 api calls to an external system where the first enumerates a large collection of objects I then loop through and perform two additional api calls each. The first call is instant, the second and third per object are very slow. Currently

Descriptor type hinting

2014-02-27 Thread Joseph L. Casale
How does one satisfy a lint/type checker with the return value of a class method decorated with a descriptor? It returns a dict, and I want the type hinting to suggest this versus the str|unknown its defaults to. Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

RE: Descriptor type hinting

2014-02-27 Thread Joseph L. Casale
Surely the answer will depend on the linter you are using. Care to tell us, or shall we guess? Hey Steven, I am using PyCharm, I have to admit I feel silly on this one. I had a buried assignment that overrode the inferred type. It wasn't until a fresh set of eyes confirmed something was awry

Unitest mock issue

2014-02-14 Thread Joseph L. Casale
I am trying to patch a method of a class thats proving to be less than trivial. The module I am writing a test for, ModuleA imports another ModuleB and instantiates a class from this. Problem is, ModuleA incorporates multiprocessing queues and I suspect I am missing the patch as the object in

Logging from a multiprocess application

2014-02-06 Thread Joseph L. Casale
I have a module that has one operation that benefits greatly from being multiprocessed. Its a console based module and as such I have a stream handler and filter associated to the console, obviously the mp based instances need special handling, so I have been experimenting with a socket server

RE: Logging from a multiprocess application

2014-02-06 Thread Joseph L. Casale
Maybe check out logstash (http://logstash.net/). That looks pretty slick, I am constrained to using something provided by the packaged modules in this scenario. I think I have it pretty close except for the fact that the LogRecordStreamHandler from the cookbook excepts when the sending

Documenting descriptors

2014-01-28 Thread Joseph L. Casale
I am documenting a few classes with Sphinx that utilize methods decorated with custom descriptors. These properties return data when called and Sphinx is content with a :returns: and :rtype: markup in the properties doc string. They also accept input, but parameter (not really applicable) nor var

RE: SQLite + FTS (full text search)

2014-01-23 Thread Joseph L. Casale
But on Windows when I use the official Python 3.3 32-bit binary from www.python.org this is not enabled. For an unobtrusive way [1] to gain this, see apsw. For what it's worth, I prefer this package over the built in module. Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC

RE: Implementing append within a descriptor

2014-01-21 Thread Joseph L. Casale
You're going to have to subclass list if you want to intercept its methods. As I see it, there are two ways you could do that: when it's set, or when it's retrieved. I'd be inclined to do it in __set__, but either could work. In theory, you could make it practically invisible - just check to

Implementing append within a descriptor

2014-01-20 Thread Joseph L. Casale
I have a caching non data descriptor that stores values in the implementing class instances __dict__. Something like: class Descriptor: def __init__(self, func, name=None, doc=None): self.__name__ = name or func.__name__ self.__module__ = func.__module__ self.__doc__

[issue20192] pprint chokes on set containing frozenset

2014-01-08 Thread Joseph Bylund
New submission from Joseph Bylund: Expected: pprint the object Observed: crash with: set([Traceback (most recent call last): File ./test.py, line 7, in module pp.pprint(myset) File /usr/lib/python2.7/pprint.py, line 117, in pprint self._format(object, self._stream, 0, 0, {}, 0

Argparse class method based instantiation

2014-01-02 Thread Joseph L. Casale
I have an Python3 argparse implementation that is invoked as a method from an imported class within a users script __main__. When argparse is setup in __main__ instead, all the help switches produce help then exit. When a help switch is passed based on the above implementation, they are

RE: Unit tests and coverage

2013-12-29 Thread Joseph L. Casale
As the script is being invoked with Popen, I lose that luxury and only gain the assertions tests but that of course doesn't show me untested branches. Should have read the docs more thoroughly, works quite nice. jlc -- https://mail.python.org/mailman/listinfo/python-list

Unit tests and coverage

2013-12-28 Thread Joseph L. Casale
I have a script that accepts cmdline arguments and receives input via stdin. I have a unit test for it that uses Popen to setup an environment, pass the args and provide the stdin. Problem is obviously this does nothing for providing coverage. Given the above specifics, anyone know of a way to

RE: Unit tests and coverage

2013-12-28 Thread Joseph L. Casale
So, back to my original question; what do you mean by providing coverage? Hi Roy, I meant touch every line, such as what https://pypi.python.org/pypi/coverage measures. As the script is being invoked with Popen, I lose that luxury and only gain the assertions tests but that of course doesn't

Formatting text in a table with reportlab

2013-12-12 Thread Joseph L. Casale
I sent off a msg to the reportlab list but didn't find an answer, hoping someone here might have come across this... I am generating a table to hold text oriented by the specification of the label it gets printed on. I need to compress the vertical size of the table a little more but the larger

finding masking boundary indices

2013-11-23 Thread Sudheer Joseph
Hi, I have a masked array like in the attached link, I wanted to find indices of the bounds where the mask is false ie in this case of depth file where there is depth less than shore. Is there a pythonic way of finding the boundary indices? please advice?

Data structure question

2013-11-17 Thread Joseph L. Casale
I have a need for a script to hold several tuples with three values, two text strings and a lambda. I need to index the tuple based on either of the two strings. Normally a database would be ideal but for a self-contained script that's a bit much. Before I re-invent the wheel, are there any

RE: Data structure question

2013-11-17 Thread Joseph L. Casale
Not entirely sure I understand you, can you post an example? If what you mean is that you need to locate the function (lambda) when you know its corresponding strings, a dict will suit you just fine. Either maintain two dicts for the two separate strings (eg if they're name and location and

RE: Data structure question

2013-11-17 Thread Joseph L. Casale
How about two dictionaries, each containing the same tuples for values? If you create a tuple first, then add it to both dicts, you won't have any space-wasting duplicates. Thanks guys. -- https://mail.python.org/mailman/listinfo/python-list

Re: writing fortran equivalent binary file using python

2013-11-14 Thread Sudheer Joseph
...@gmail.comwrote: On 14 November 2013 00:53, Sudheer Joseph sjo.in...@gmail.com wrote: My trial code with Python (data is read from file here) from netCDF4 import Dataset as nc import numpy as np XFIN=0.0,YFIN=-90.0,NREC=1461,DXIN=0.5;DYIN=0.5 TITLE=NCMRWF 6HOURLY FORCING MKS nf=nc

writing fortran equivalent binary file using python

2013-11-13 Thread Sudheer Joseph
Hi, I need to write a binary file exactly as written by fortran code below to be read by another code which is part of a model which is not advisable to edit.I would like to use python for this purpose as python has mode flexibility and easy coding methods. character(40) ::

RE: Compiling Python 3.3.2 on CentOS 6.4 - unable to find compiled OpenSSL?

2013-11-04 Thread Joseph L. Casale
Any thoughts on what we're doing wrong? Building them yourself:) Try iuscommunity.org for prebuilt packages... -- https://mail.python.org/mailman/listinfo/python-list

RE: Using with open(filename, 'ab'): and calling code only if the file is new?

2013-10-29 Thread Joseph L. Casale
with open(self.full_path, 'r') as input, open(self.output_csv, 'ab') as output: fieldnames = (...) csv_writer = DictWriter(output, filednames) # Call csv_writer.writeheader() if file is new. csv_writer.writerows(my_dict) I'm wondering what's the best

RE: Using with open(filename, 'ab'): and calling code only if the file is new?

2013-10-29 Thread Joseph L. Casale
Like Victor says, that opens him up to race conditions. Slim chance, it's no more possible than it happening in the time try/except takes to recover an alternative procedure. with open('in_file') as in_file, open('out_file', 'ab') as outfile_file: if os.path.getsize('out_file'):

Logging timezones

2013-10-26 Thread Joseph L. Casale
The default converter attribute uses localtime, but often under windows when I add an additional logger, create a new file handler and set a formatter the time switches to utc. Obviously redefining a new converter class does nothing as the default is what I wanted to start with, localtime.

RE: Barcode printing

2013-09-30 Thread Joseph L. Casale
If that's a bit heavyweight (and confusing; it's not all free software, since some of it is under non-free license terms), there are other options. pyBarcode URL:http://pythonhosted.org/pyBarcode/ says it's a pure-Python library that takes a barcode type and the value, and generates an SVG of the

Barcode printing

2013-09-29 Thread Joseph L. Casale
I need to convert a proprietary MS Access based printing solution into something I can maintain. Seems there is plenty available for generating barcodes in Python, so for the persons who have been down this road I was hoping to get a pointer or two. I need to create some type of output,

[issue19052] Python's CGIHTTPServer does not handle Expect: 100-continue gracefully which results in some Post requests being handled slowly.

2013-09-19 Thread Joseph Warren
New submission from Joseph Warren: I will add as a disclaimer to this bug report that I am relatively new to both the http spec, and Python programming, so I may have completely misunderstood something. When I make a post request with some data (using libCurl), It sends the headers first

[issue19052] Python's CGIHTTPServer does not handle Expect: 100-continue gracefully which results in some Post requests being handled slowly.

2013-09-19 Thread Joseph Warren
Joseph Warren added the comment: Cheers, would you suggest I submit a patch then? Also what version of python should I do this against? I've been working with 2.7, but the issue still exists in 3.* and I can conveniently work against 3.2.3-7, and less conveniently work against other versions

[issue19052] Python's CGIHTTPServer does not handle Expect: 100-continue gracefully which results in some Post requests being handled slowly.

2013-09-19 Thread Joseph Warren
Joseph Warren added the comment: Issue1346874 seems similar, but is talking about a failure to handle 100 Continue responses sent by a server to the client, this issue is in server code, and is a failure of BaseHttpServer to send 100 Continue responses to a client which expects them. Please

[issue19052] Python's CGIHTTPServer does not handle Expect: 100-continue gracefully which results in some Post requests being handled slowly.

2013-09-19 Thread Joseph Warren
Joseph Warren added the comment: Have downloaded an up to date version of Python to develop with, and found that this issue had been fixed in it. This seems to have been done in changeset: 65028:7add45bcc9c6 changeset: 65028:7add45bcc9c6 user:Senthil Kumaran orsent...@gmail.com

[issue19052] Python's CGIHTTPServer does not handle Expect: 100-continue gracefully which results in some Post requests being handled slowly.

2013-09-19 Thread Joseph Warren
Joseph Warren added the comment: Sorry, this change does appear in 2.7.* I was looking at the wrong mercurial Tag -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19052

[issue19052] Python's CGIHTTPServer does not handle Expect: 100-continue gracefully which results in some Post requests being handled slowly.

2013-09-19 Thread Joseph Warren
Changes by Joseph Warren hungryjoe.war...@gmail.com: -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19052

RE: sqlite issue in 2.7.5

2013-09-09 Thread Joseph L. Casale
This pragma speeds up most processes 10-20 times (yes 10-20): pragma synchronous=OFF See the SQLITE documentation for an explanation. I've found no problems with this setting. Aside from database integrity and consistency? :) I have that one set to OFF as my case mandates data processing and

sqlite issue in 2.7.5

2013-09-02 Thread Joseph L. Casale
I have been battling an issue hopefully someone here has insight with. I have a database with a few tables I perform a query against with some joins against columns collated with NOCASE that leverage = comparisons. Running the query on the database opened in sqlitestudio returns the results in

RE: Running a command line program and reading the result as it runs

2013-08-23 Thread Joseph L. Casale
I'm using Python 2.7 under Windows and am trying to run a command line program and process the programs output as it is running. A number of web searches have indicated that the following code would work. import subprocess p = subprocess.Popen(D:\Python\Python27\Scripts\pip.exe list

<    1   2   3   4   5   6   7   >