cannot import glib in python shell

2009-12-23 Thread uticdmarceau2...@yahoo.ca
Hello everyone,

I'm trying to document a recipe to get the anomos python sources running
on winxp Pentium3 laptop.  I've installed the latest 2.6
python/mingw/msys/gtk and related binaries(glib, etc...)

This link has all the information about running anomos python sources on
a linux box:
http://anomos.info/trac/wiki/KnowledgeBase

---
Here is my msys/home/user/.profile:
CC='/mingw/bin/gcc.exe '
CFLAGS='-march=pentium3 -mtune=i586 -mthreads -O2 -fomit-frame-pointer
-mms-bitfields -pipe '
CPPFLAGS='-I/mingw/include -DMINGW32 -D__MINGW32__ '
CXXFLAGS="${CFLAGS}"
LDFLAGS='-L/mingw/lib -Wl,--enable-auto-image-base
-Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc '
PKG_CONFIG_PATH="C:\MinGW\lib\pkgconfig"
export CC CFLAGS CPPFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH

export
PATH=.:/c/OpenSSL:/c/OpenSSL/bin:/c/OpenSSL/lib:/c/Venster/venster:/c/Venster:/c/gccxml:/c/Python26:/c/Python26/Lib/site-packages/M2Crypto:/c/Python26/DLLs:/c/Python26/tcl/dde1.3:/c/Python26/tcl/reg1.2:/c/Python26/tcl/tix8.4.3:/c/gtkwin/bin:c/gtkwin/lib:/c/gtkmm/bin:/c/gtkmm/lib:/c/gtkmm/redist:/mingw/bin:/bin:/usr/local/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:"/c/Program
Files/Common Files/Ahead/Lib"
export
PKG_CONFIG_PATH=/c/Python26/Lib/pkgconfig:/c/gtkmm/lib/pkgconfig:/c/gtkwin/lib/pkgconfig:/c/gtkwin/manifest:/c/mingw/lib/pkgconfig
export
LD_LIBRARY_PATH=/c/gtkmm/redist:/c/gtkmm/bin:/c/gtkwin/bin:/c/gtkwin/lib:/c/mingw/lib
-
The odd thing is that I can compile a c++ source file that needs glib
and it's running/linking, but the python doesn't find glib when I do
"import glib" from the python shell.
gcc -Wall -o anomos.exe pkg-config --cflags gtkmm-2.4 pangomm-1.4
anomos.cc pkg-config --libs gtkmm-2.4 pangomm-1.4 -lstdc++
glib is at least in two dirs:gtkwin/lib and mingw/lib because the
binaries are installed in gtkwin/lib and I compile glib with the latest
sources and installed/tested them from mingw/lib.
-

I think ideally what I'm requesting is to have the mingw/python/gtk
environments to be harmonized.  I'm close.  I can do the following:
python
import sys
import gtk
blah = gtk.Window(0)
blah.show()
, but when I do
import glib
ERROR!!!
if I cd to a certain dir in glib sources, there were two .py files, but
I didn't know where to place them in the python26 dir.
>From that dir, I can run the python shell, import glib and then it gives
me an error about no module for gdb...so it's none stop...with regards
to the import glib issue at present.

Any help towards this would be greatly appreciated.

Cheers,
David Marceau


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


Re: More On the Strange Problem

2009-12-23 Thread uticdmarceau2...@yahoo.ca
Victor Subervi wrote:
> On Wed, Dec 23, 2009 at 2:21 PM, Victor Subervi 
> wrote:
> 
>> I've isolated the problem in the print-out at the bottom of this post. It
>> occurs when these values are passed:
>>
>> ['LastDatePrice', 'date', '10', '/mm/dd', None],
>>
>> Since this is the first datetime that is passed, it would appear to be
>> associated with such values, which are processed thus:
>>
>> elif typeName == 'datetime':
>>   print "> value='%s' /> " \
>> "This field takes a datetime up to %s alphanumeric characters
>> inclusive." \
>> % (shortNum, str(typeNum), colName, theVal, str(typeNum))
>>
>> colName == 'LastDatePrice'
>> typeNum = 10
>>
>>   elif 10 < int(typeNum) < 20:
>> shortNum = '10'
>>
>> Therefore...
>> shortNum = '10'
>>
>> if whatDo == 'insert':
>>   theVal = defaultVal
>>   val = defaultVal
>>
>> Since whatDo == 'insert'...
>> and
>> val = '/mm/dd'
>> therefore
>> theVal = None
>>
>> Now, this value of None doesn't cause any problems with the other values
>> printed out. This is the code:
>>
>>   print 'printTheForm: ', descrProds, ''
>>   for value in descrProds:
>> print 'value: ', value, ''
>>
>> that produces this print-out:
>>
>> printTheForm: [['ID', 'tinyint', '5', '0', None], ['SKU', 'varchar', '40',
>> '', None], ['Category', 'varchar', '40', '', None], ['Name', 'varchar',
>> '50', '', None], ['Title', 'varchar', '100', '', None], ['Description',
>> 'mediumtext', '100', '', None], ['Price', 'float', '8', '0.0', None],
>> ['SortFactor', 'int', '4', '0', None], ['Availability', 'tinyint', '1', '0',
>> '1'], ['OutOfStock', 'tinyint', '1', '0', '0'], ['ShipFlatFee', 'float',
>> '5', '0.0', '0.00'], ['ShipPercentPrice', 'tinyint', '2', '0', '0'],
>> ['ShipPercentWeight', 'tinyint', '2', '0', '0'], ['Associations', 'varchar',
>> '40', '', None], ['TempPrice', 'tinyint', '1', '0', None], ['LastDatePrice',
>> 'date', '10', '/mm/dd', None], ['Weight', 'float', '7', '0.0', None],
>> ['Metal', 'enum', ['14k gold', '18k gold', 'white gold', 'silver',
>> 'tungsten', 'titanium'], '', None], ['PercentMetal', 'tinyint', '2', '0',
>> None], ['colorsShadesNumbersShort', 'set', [''], '', None]]
>> value: ['ID', 'tinyint', '5', '0', None]
>> value: ['SKU', 'varchar', '40', '', None]
>> value: ['Category', 'varchar', '40', '', None]
>> value: ['Name', 'varchar', '50', '', None]
>> value: ['Title', 'varchar', '100', '', None]
>> value: ['Description', 'mediumtext', '100', '', None]
>> value: ['Price', 'float', '8', '0.0', None]
>> value: ['SortFactor', 'int', '4', '0', None]
>> value: ['Availability', 'tinyint', '1', '0', '1']
>> value: ['OutOfStock', 'tinyint', '1', '0', '0']
>> value: ['ShipFlatFee', 'float', '5', '0.0', '0.00']
>> value: ['ShipPercentPrice', 'tinyint', '2', '0', '0']
>> value: ['ShipPercentWeight', 'tinyint', '2', '0', '0']
>> value: ['Associations', 'varchar', '40', '', None]
>> value: ['TempPrice', 'tinyint', '1', '0', None]
>> value: ['LastDatePrice', 'date', '10', '/mm/dd', None]
>>
>> If in fact the problem has to do with the None value, how can I easily
>> substitute a different value? I tried:
>>
>> if theVal == None:
>>   theVal = ''
Taken from:  http://boodebr.org/main/python/tourist/none-empty-nothing:

tags = parse_file(filename)
if tags is None:
print "** ERROR **"
elif len(tags) == 0:
print "Empty file"
else:
print "OK!"


>>
>> but that didn't capture it.
>>
> 
> Update:
> It's a date value (not datetime). I updated the database to default to the
> value "2000-01-01" but that didn't help (gave the same print-out as above).
> 
> 
>> TIA,
>> beno
>>
> 


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


Re: creating ZIP files on the cheap

2009-12-23 Thread uticdmarceau2...@yahoo.ca
samwyse wrote:
> I've got an app that's creating Open Office docs; if you don't know,
> these are actually ZIP files with a different extension.  In my case,
> like many other people, I generating from boilerplate, so only one
> component (content.xml) of my ZIP file will ever change.  Instead of
> creating the entire ZIP file each time, what is the cheapest way to
> accomplish my goal?  I'd kind-of like to just write the first part of
> the file as a binary blob, then write my bit, then write most of the
> table of contents as another blob, and finally write a TOC entry for
> my bit.  Has anyone ever done anything like this?  Thanks.
I think you intend on using simply the command-line infozip tool from
python system commands:
mycmd = "zip -r content.xml foo.zip"
mycmd = "zip -i your.blob foo.zip"
try:
mycmd = "zip -r content.xml foo.zip"
retcode = call(mycmd, shell=True)
mycmd = "zip -i your.blob foo.zip"
retcode = call(mycmd, shell=True)
if retcode < 0:
print >>sys.stderr, "Child was terminated by signal", -retcode
else:
print >>sys.stderr, "Child returned", retcode
except OSError, e:
print >>sys.stderr, "Execution failed:", e

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