Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread Terry Reedy
walterbyrd wrote: I have about 150 unix formated text files that I would like to convert to dos formated. Are you sure you need to do that? Most Windows programs (including Python) are happy reading text files with just \n for line endings. -- http://mail.python.org/mailman/listinfo/python-

Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread norseman
walterbyrd wrote: I have about 150 unix formated text files that I would like to convert to dos formated. I am guessing that I loop though each file in the directory, read each line and conver the last character, then save to a file with the same name in another directory. I am not really sure

Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-12 Thread David Lyon
On Tue, 12 May 2009 23:57:48 GMT, David Lees > Mark and David, > > Thanks for the help. I just got it to install for Python 2.6. All I > did was change PYTHONPATH (as suggested by Mark) from > C:\Python25\Lib\site-packages to C:\Python26\Lib\site-packages lol - so simple... Thankfully, we g

py2exe + win32com + DAO

2009-05-12 Thread Trevor
I have a Python code module that adds records to a MS Access database. The following line of code executes successfully when the code module is run as a Python script: daoEngine = win32com.client.Dispatch(r'DAO.DBEngine.36') It also runs successfully when the Python script is compiled and run as

Re: py2exe + win32com + DAO

2009-05-12 Thread David Lyon
Maybe VB is opening the table in Exclusive mode... then when you are opening it as a subprocess, it's already locked. It's possible the win32com module is not giving you a very descriptive error message. Try running your process while vb is running at the same time with the database open and if

Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-12 Thread David Robinow
> Thanks for the help.  I just got it to install for Python 2.6.  All I did > was change PYTHONPATH (as suggested by Mark) from > C:\Python25\Lib\site-packages to C:\Python26\Lib\site-packages Why do you have PYTHONPATH set at all? -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite single transaction without foreign key or triggers

2009-05-12 Thread Aahz
In article , Rob Williscroft wrote: >Aahz wrote in news:guao50$1j...@panix3.panix.com in comp.lang.python: >> In article , >> Rob Williscroft wrote: >>> >>>db.execute( ''' >>> update "sessions" set "uid" = ? >>> where "uid" = ? >>> and exists( >>> selec

Help with a HTTP GET request

2009-05-12 Thread Paul Hemans
I am trying to build a HTTP request that looks like: http://localhost/common/foxisapi.dll/tmsmail.x2.isapi? Works in a browser. lxml.parse() gives me: failed to load external entity urllib2.urlopen() gives me: Bad request So I am trying httplib I have encoded the GET request with urllib.quote ()

Re: Help with a HTTP GET request

2009-05-12 Thread Chris Rebert
On Tue, May 12, 2009 at 7:20 PM, Paul Hemans wrote: > I am trying to build a HTTP request that looks like: > http://localhost/common/foxisapi.dll/tmsmail.x2.isapi? > Works in a browser. I'm not 100% sure, but I don't think you can have < or > in a URL. Your browser might be implicitly encoding th

Re: Help with a HTTP GET request

2009-05-12 Thread Stephen Hansen
> I am trying to build a HTTP request that looks like: > http://localhost/common/foxisapi.dll/tmsmail.x2.isapi > ? > Works in a browser. > > and now I am attempting to use HTTPConnection > >>> conn = httplib.HTTPConnection("localhost") > >>> print x > %3CPROCESS%20sync%3D%27%27%20schema%3D%27%27%20

Re: sqlite single transaction without foreign key or triggers

2009-05-12 Thread John Machin
On May 13, 11:46 am, a...@pythoncraft.com (Aahz) wrote: > In article , > Rob Williscroft   wrote: > > > > >Aahz wrote innews:guao50$1j...@panix3.panix.comin comp.lang.python: > >> In article , > >> Rob Williscroft   wrote: > > >>>db.execute( ''' > >>>         update "sessions" set "uid" = ? > >>>  

Re: Help with a HTTP GET request

2009-05-12 Thread Tim Harig
On 2009-05-13, Paul Hemans wrote: > http://localhost/common/foxisapi.dll/tmsmail.x2.isapi? Note the entire URL. > So I am trying httplib I have encoded the GET request with urllib.quote urllib would be much easier if you don't need low level control -- it will automatically call httplib for you.

Re: Help with a HTTP GET request

2009-05-12 Thread Tim Harig
On 2009-05-13, Tim Harig wrote: > import urllib > url = > "http://localhost/common/foxisapi.dll/tmsmail.x2.isapi? content = urllib.urlopen(url).read() forgot to urlencode: host = "http://localhost"; request = r"""/common/foxisapi.dll/tmsmail.x2.isapi?http://mail.python.org/mailman/listinfo/pyth

Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread Simon Forman
On May 12, 4:39 pm, walterbyrd wrote: > I have about 150 unix formated text files that I would like to convert > to dos formated. > > I am guessing that I loop though each file in the directory, read each > line and conver the last character, then save to a file with the same > name in another dir

Re: Help with a HTTP GET request

2009-05-12 Thread Tim Harig
On 2009-05-13, Tim Harig wrote: > host = "http://localhost"; > request = r"""/common/foxisapi.dll/tmsmail.x2.isapi? schema='' class='replicateApplication.getChanges' /""" > url = host + urllib.quote(request) > content = urllib.urlopen(url).read() Which accidentally encodes the '?' separator. Thi

Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread walterbyrd
On May 12, 6:12 pm, Terry Reedy wrote: > Are you sure you need to do that?  Most Windows programs (including > Python) are happy reading text files with just \n for line endings. These files will be looked at by some non-technical people. I am sure these people will just click on the icons, and

Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-12 Thread Martin v. Löwis
> lol - so simple... > > Thankfully, we got a quick answer by the package writing master himself.. > > but imho - package installation shouldn't be that tricky.. it should be > click and shoot... which is what i'm working on doing.. > > I have to say that I don't mind being corrected because I

Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread walterbyrd
On May 12, 6:15 pm, norseman wrote: > Subject line says UNIX to DOS > > I hope that means you are using a UNIX machine. > I should have mentioned, I am working in an environment that is very restrictive about what I can put on my XP desktop. I can not put python, or even notepad++, on my desktop

Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread walterbyrd
Thanks for shell script code. That code may be just as efficient, or even more efficient, than python. But, to me, python is far more readable. i=$1 i1=${i%%.*} echo $i1 cat $1 | sed s/^M// >$i1._cr ---= import os for file in os.listdir('.'): infile = o

Re: piping input to an external script

2009-05-12 Thread Tim Arnold
"Dave Angel" wrote in message news:mailman.25.1242113076.8015.python-l...@python.org... > Tim Arnold wrote: >> Hi, I have some html files that I want to validate by using an external >> script 'validate'. The html files need a doctype header attached before >> validation. The files are in utf8

Representing a Tree in Python

2009-05-12 Thread godshorse
Hello, I want to find out the shortest path tree from a root to several nodes in a graph data structure. I found a Dijkstra code from internet that finds shortest path between only two nodes. How can i extend it to a tree?. And what is the best way to represent a tree in Python?. Thank you, -- h

Re: Help with a HTTP GET request

2009-05-12 Thread Carbon-based
Great, thank you very much. On May 13, 1:38 pm, Tim Harig wrote: > On 2009-05-13, Tim Harig wrote: > > > host = "http://localhost"; > > request = r"""/common/foxisapi.dll/tmsmail.x2.isapi? > schema='' class='replicateApplication.getChanges' /""" > > url = host + urllib.quote(request) > > content

New to python, can i ask for a little help?

2009-05-12 Thread warhammer1...@gmail.com
I loaded python 3.1 I can use the gui and i see the following: Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> It would seem that this is working correctly and there is no path problem. I am

Re: What's the use of the else in try/except/else?

2009-05-12 Thread greg
kj wrote: Wow. As rationales for syntax constructs go, this has got to be the most subtle one I've ever seen... It's to avoid masking bugs. Suppose you accidentally wrote try: v = mumble.field sys.warming('field was actually there?') except AttributeError: pass Then you coul

Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-12 Thread David Lyon
On Wed, 13 May 2009 05:32:16 +0200, "Martin v. Löwis" wrote: > I think this was a case of obscure misconfiguration of the system. > It is always possible to configure a system in such a way that even > the most resilient installation procedure will break. Technically, you are right.. but imho.

Re: New to python, can i ask for a little help?

2009-05-12 Thread Sam Tregar
On Wed, May 13, 2009 at 12:18 AM, warhammer1...@gmail.com < warhammer1...@gmail.com> wrote: > Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > >>> print "hello world!" > SyntaxError: invalid

Re: New to python, can i ask for a little help?

2009-05-12 Thread Chris Rebert
On Tue, May 12, 2009 at 9:18 PM, warhammer1...@gmail.com wrote: > I loaded python 3.1 > I can use the gui and i see the following: > > Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > >

Re: New to python, can i ask for a little help?

2009-05-12 Thread Mensanator
On May 12, 11:18�pm, "warhammer1...@gmail.com" wrote: > I loaded python 3.1 > I can use the gui and i see the following: > > Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > > > > It would s

Re: Representing a Tree in Python

2009-05-12 Thread CTO
On May 13, 12:10 am, godshorse wrote: > Hello, > > I want to find out the shortest path tree from a root to several nodes > in a graph data structure. I found a Dijkstra code from internet that > finds shortest path between only two nodes. How can i extend it to a > tree?. And what is the best way

Re: py2exe + win32com + DAO

2009-05-12 Thread Trevor
I do not believe your assertion applies to the following line of code: daoEngine = win32com.client.Dispatch(r'DAO.DBEngine.36') The preceding code snippet instantiates a COM object and is prerequisite to creating a reference to a specific database: daoDB = daoEngine.OpenDatabase(dbname) As the

Re: Convert UNIX formated text files to DOS formated?

2009-05-12 Thread Jeroen Ruigrok van der Werven
-On [20090513 05:53], walterbyrd (walterb...@iname.com) wrote: >As you probably know, cygwin formats to UNIX. That entirely depends on how you install it. Anyway, I am sure the Cygwin repository has the tools dos2unix/unix2dos available for installation. -- Jeroen Ruigrok van der Werven / asmo

Re: py2exe + win32com + DAO

2009-05-12 Thread David Lyon
On Tue, 12 May 2009 22:06:42 -0700 (PDT), Trevor wrote: > I do not believe your assertion applies to the following line of code: > > daoEngine = win32com.client.Dispatch(r'DAO.DBEngine.36') It doesn't. I'm simply suggesting that it is possible you are opening the database in Access or something

Updates to enviironment variables and ctypes

2009-05-12 Thread Scott Flynn
I was hoping I could update LD_LIBRARY_PATH at runtime and load a library through ctypes from there, but I haven't been able to. I've tried all of these. os.environ['LD_LIBRARY_PATH'] = "./lib" os.putenv('LD_LIBRARY_PATH', "./lib") os.system("export LD_LIBRARY_PATH=./lib") lib = CDLL("libevaluato

Re: Representing a Tree in Python

2009-05-12 Thread godshorse
On May 13, 11:54 am, CTO wrote: > On May 13, 12:10 am, godshorse wrote: > > > Hello, > > > I want to find out the shortest path tree from a root to several nodes > > in a graph data structure. I found a Dijkstra code from internet that > > finds shortest path between only two nodes. How can i ext

Re: New to python, can i ask for a little help?

2009-05-12 Thread guang . zeng37
On May 13, 12:18 pm, "warhammer1...@gmail.com" wrote: > I loaded python 3.1 > I can use the gui and i see the following: > > Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > > > > It would s

<    1   2