executable egg?

2015-06-18 Thread dmaziuk
Hi all,

Here's my directory structure:

myegg/
pkg1/
__init__.py
...
pkg2/
__init__.py
...
pkg3/
__init__.py
...
setup.py

I can make an egg with python setup.py bdist_egg and it works just fine. I'd 
like to make it executable with python myegg.egg which is supposed to be 
doable in 2.6+. According to everything I can find, all I need is to add

myegg/
__main__.py

The end result, however, is /usr/bin/python: can't find '__main__' module. It 
is correct: checking the egg with unzip -l shows that __main__.py is indeed not 
in it. So I played with options for including package data, also made a stab or 
two at entry_points with no luck.

So, what am I missing. Or does it only work with one package in the egg?

(I'm using 2.7  2.6 on centos 7  6 resp.)
TIA,
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python] how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-25 Thread dmaziuk
D'oh. You're right, of course.

Thank you
Dima
-- 
http://mail.python.org/mailman/listinfo/python-list


how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread dmaziuk
Hi everyone,

I've wrapper class around some sql statements and I'm trying to add a
method that does:
  if my_cursor is a sqlite cursor, then run select
last_insert_rowid()
  else if it's a psycopg2 cursor, then run select
currval( 'my_sequence' )
  etc.
The best I can come up with is import both psycopg2 and sqlite and
then do
 if isinstance( self._curs, sqlite.Cursor ) : ...
 elif isinstance( self._curs, psycopg2._psycopg.cursor ) : ...
and I can't help thinking there has to be another way to find out what
kind of thing self._curs is. Is there a better way?

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


Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread dmaziuk
For psycopg2: 'cursor object at 0x2b60b6066a48; closed: 0'
(of course, this could also be due to RHEL5's ancient python).

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