ironpython with nosetest

2007-09-24 Thread belred
has anyone tried nosetest with ironpython?  i installed IPCE-r6,
copied the nose directory below the .egg directory from my cpython
directory and copied to IPCE-r6/lib.  i then created a file called
n.py which contained two lines:

import nose
none.run()

i was then able to run it against a test file such as:

ipy n.py test_n.py

or

ipy n.py test_n.py:TestTest.test_f1

it worked as expected.  what doesn't work is if i omit the file name
and just run ipy n.py, it won't discover any test files. -w (working
directory) and -a (attribute) options seem to be ignored. but -s for
(don't capture output) and -h (help) does work.


thanks,

bryan

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


count pages in a pdf

2007-11-27 Thread belred
is it possible to parse a pdf file in python?  for starters, i would
like to count the number of pages in a pdf file.  i see there is a
project called ReportLab, but it seems to be a pdf generator... i
can't tell if i would be able to parse a pdf file programmically.

thanks for any recommendations.

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


JSON

2007-12-06 Thread belred
i tried a couple python json libraries. i used simplejson on the
server and was using cjson on the client, but i ran into this issue.
i'm now using simplejson on both sides, but i'm still interested in
this issue.  did i do something wrong? is there a bug in one of the
libraries? or something i don't understand about the json spec?


i problem is the line where i call cjson.decode() below:

>>> import simplejson
>>> import cjson
>>>
>>> sj = simplejson.dumps('http://server.com')
>>> sj
'"http:\\/\\/server.com"'
>>> cj = cjson.encode('http://server.com')
>>> cj
'"http://server.com";'
>>> simplejson.loads(cj)
u'http://server.com'
>>> cjson.decode(cj)
'http://server.com'
>>> simplejson.loads(sj)
u'http://server.com'
>>> cjson.decode(sj)
'http:\\/\\/server.com' # is this correct


is that last statement really correct?

thanks,

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


dependency order

2008-02-09 Thread belred
i'm having trouble trying to figure this out... it's part of a build
system i'm writing in python.  maybe someone has a good simple way to
solve this.  i'm trying to create a dependency order out of multiple
lists.

list1: B C
list2: A B
list3: A C

i want the end result to be the list: A B C
i'm very frustrated that i can't come up with anything that always
works.


thanks... any clues to solve this would be greatly appreciated.

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


Re: dependency order

2008-02-09 Thread belred
On Feb 9, 11:10 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] schrieb:
>
> > i'm having trouble trying to figure this out... it's part of a build
> > system i'm writing in python.  maybe someone has a good simple way to
> > solve this.  i'm trying to create a dependency order out of multiple
> > lists.
>
> > list1: B C
> > list2: A B
> > list3: A C
>
> > i want the end result to be the list: A B C
> > i'm very frustrated that i can't come up with anything that always
> > works.
>
> > thanks... any clues to solve this would be greatly appreciated.
>
> Maybe the frustration is based on the IMHO wrong data-structure you use.
> What does [B, C] mean?
>
> A common approach for this is to create a dict instead, that maps an
> object to the list of things it depends on (or that depend on it, it's
> essentially the same)
>
> The resulting data-structure is called a directed graph, and there are
> algorithms like "partial orderings" you can google for that will help you.
>
> An example graph would be:
>
> dict(
> "A" : ["B", "C"],
> "B" : ["C"]
> "C" : []
> )
>
> Then the result of a partial ordering would be
>
> ["C", "B", "A"]
>
> which should be what you are after.
>
> Diez


i found this program in pypi, it does exactly what i was after :)

http://pypi.python.org/pypi/topsort/0.9

>>> from topsort import topsort
>>> topsort([('B', 'C'),('A', 'B'),('A', 'C')])
['A', 'B', 'C']

very cool!!! i will be able to adapt this to my program without any
problems.



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


document/image viewer

2008-11-16 Thread belred
does anyone know of any document/image viewers?  i would like to
create an app that can display (read-only) many types of documents
such as .doc, .xls, .tiff, .pdf, etc.  it would be great if i can do
this using python.   looks like i might be able to create something
with PIL, but i'm coming up empty handed for non-image types.

thanks,

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


u'\N{dollar sign}'

2009-05-20 Thread belred
i can't for the life of me figure out where the unicode \N specifier
is located in the python documentation (2.6).  can anyone point me to
the page in the docs?

thanks,

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


dynamically getting loggers

2008-08-14 Thread belred
is there a way to dynamically get all the active loggers?

i currently have code like this in different areas of the program:

import logging
log = logging.getLogger('foo')


i would like to write a function that dynamically get a list of all
the logger names such as 'foo'.  or get a list of the loggers which i
could then get the names.  is this even possible?  i don't see a
logger function that returns loggers.

thanks,

bryan



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


how many objects are loaded for hello world?

2008-09-16 Thread belred
i just read this blog about how many objects (types) are loaded for a
hello world program in C#.

http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx

how can you find out how many are loaded for a python program:  print
'hello'




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