Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Peter A.Schott
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of working Python scripts to paste into my interactive console and let those run so I don't have to copy l

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Peter A.Schott
I'll give it a try. I've been using PythonWin and SPE recently and hadn't really messed with IDLE too much as I liked the somewhat more advanced features of the other IDEs. I'll check it out again. Also thanks to all for the IP hints - I may check those out as well. -Pete "Devan L" <[EMAIL PRO

Re: Command-line tool able to take multiple commands at one time?

2005-11-11 Thread Peter A.Schott
OK - I justed tested and may be doing something wrong, but it didn't work when I just tried it. I have something like this: X = "Value1" Y = "Value2" Z = "Value3" etc at the top of my script. When I copy/paste those three lines all at once into IDLE's interactive window, X is defined, Y and Z a

Catching error text like that shown in console?

2005-12-09 Thread Peter A.Schott
I know there's got to be an easy way to do this - I want a way to catch the error text that would normally be shown in an interactive session and put that value into a string I can use later. I've tried just using a catch statement and trying to convert the output to string, but this doesn't alway

Best way to trap errors in ftplib?

2005-01-11 Thread Peter A.Schott
Using ftplib.FTP object for a project we have here to upload/download files. I know that I can wrap everything in try/except blocks, but I'm having trouble getting the exact error messages out of the Exceptions. I'd like to either send an e-mail or log the failure to a database. It would also be

Re: python to mssql

2005-01-17 Thread Peter A.Schott
Brane, What are you wanting to know specifically? What is your client machine running? I've started using the Win32 modules to connect using ADODB and that works for me on Windows XP (hopefully 2003 as well, but not tested yet). I pulled those samples from someplace on the net using Goog

FTPLIB - retry files?

2005-01-17 Thread Peter A.Schott
Is there any way to retry sending files with some delay up to a set number on failure? Sometimes we encounter a locked file on our server or the destination server and we want to retry that file in X seconds. Not exactly sure how to go about that right now short of moving the files elsewhere and

FTPLIB & FTPS or SFTP?

2005-01-19 Thread Peter A.Schott
Does the ftplib support SFTP or FTPS? Is that part of a different module? We have a handful of partners who use FTPS or SFTP and I need to pull/push files to/from them. Thank you for all of your help. -Pete Schott -- http://mail.python.org/mailman/listinfo/python-list

Re: FTPLIB & FTPS or SFTP?

2005-01-20 Thread Peter A.Schott
Can't seem to hit the site right now. I'll have to try back later. From what I can tell, there aren't any mirrors set up, either. Two quick recommendations is promising, though. Thanks for the recommendations. -Pete "Roger Binns" <[EMAIL PROTECTED]> wrote: > > "Peter A. Schott" <[EMAIL PROT

ftplib help - delete from server after download results in 0-byte file

2005-02-01 Thread Peter A.Schott
Got a strange scenario going on here in that I could have sworn this worked yesterday. I am issuing binary retrieval calls to an FTP server, writing to a file, close the file, then removing the file from the remote site. When I do this, I end up with 0 byte files. I was hoping to avoid parsing a

Re: httplib/HTTPS Post Problem

2005-07-14 Thread Peter A.Schott
Have you tried using pycurl? That may be an easier way to port over your CURL code directly. Relatively easy to use, too. -Pete [EMAIL PROTECTED] wrote: > Hi, > > Sorry to post what might seem like a trivial problem here, but its > driving me mad! > > I have a simple https client that uses h

Help sorting a list by file extension

2005-08-11 Thread Peter A.Schott
Trying to operate on a list of files similar to this: test.1 test.2 test.3 test.4 test.10 test.15 test.20 etc. I want to sort them in numeric order instead of string order. I'm starting with this code: import os for filename in [filename for filename in os.listdir(os.getcwd())]: print

Re: Help sorting a list by file extension

2005-08-12 Thread Peter A.Schott
OK - I actually got something working last night with a list that is then converted into a dictionary (dealing with small sets of data - < 200 files per run). However, I like the sorted list option - I didn't realize that was even an option within the definition and wasn't quite sure how to get th

Re: Text/IDE Python Editor?

2005-08-12 Thread Peter A.Schott
Also, it depends on what you're trying to do. GUI, Web, Service-type apps, etc. I have started using Stan's Python Editor (www.stani.be) because I like the general features it offers. It does require wxpython to run, though. I've also used Boa Constructor and DrPython - both pretty good environ

Python & SQL Server DTS?

2005-08-17 Thread Peter A.Schott
Got a strange issue here. I know that MS allows other scripting languages to run in its ActiveX tasks in DTS. I can change one of the tasks to run Python code, create a Main function, and run it manually. However, once I try to run the entire package, the package hangs at this step. It doesn't

ftplib - issues with some files not completing?

2005-08-23 Thread Peter A.Schott
Any tips/tricks on how to ensure that I've got the complete file before closing the local file? I think my code is basically correct and works more than 99% of the time, but it still has an occasional issue with an encrypted file where it doesn't receive the whole file and I can't decrypt it. Sho

Re: High Level FTP library

2005-08-23 Thread Peter A.Schott
I've used the ftputil package before with some success. It's not bad, but it really depends on what you're trying to do. If you write a couple of custom functions to get you started, you should be able to put those in a module and re-use as needed. I know that I had to code my own stuff to handl

Sorta noob question - file vs. open?

2005-08-23 Thread Peter A.Schott
Been reading the docs saying that file should replace open in our code, but this doesn't seem to work: # Open file for writing, write something, close file MyFile = file("MyFile.txt", "w") MyFile.write("This is a test.") MyFile.close() However, using: MyFile = open("MyFile.txt", "w") MyFile.write

Re: Sorta noob question - file vs. open?

2005-08-24 Thread Peter A.Schott
I'll have to try this again. I obviously did something wrong in my code. I was getting errors about not being able to write a string because it wasn't supported. It was driving me nuts for a while until I just gave up and went back to open(). I'll do some more playing and if I continue to get e

Re: FTP Error: Windows AS/400

2005-09-13 Thread Peter A.Schott
I've used DOS FTP to hit AS/400 systems before and usually have to completely qualify the file name or ensure that I'm in the correct directory. When you use command-line FTP to get the file, do these commands mimic your commands? What version of python are you using? If you issue PWD on the FTP

ftplib - file.write, file.close() - verify finished writing locally before delete source?

2005-02-10 Thread Peter A.Schott
If I want to verify that a file has finished writing before deleting the remote file, what would be the best method? Current code on Python 2.4: #filename - remote FTP server File Name #NewFile - local file copy of the remote file #objFTP - standard ftplib.FTP object NewFile = open(os.path.join(

Re: About Databases...

2005-03-15 Thread Peter A.Schott
Have to agree with others here - get a good database backend. MSSQL/Oracle - good choices commercially. Both of these offer good feature sets and have a lot of support from users. However, they are commercial apps and not necessarily free. (You can play with MS SQL Server in the Develope

Best way to parse file into db-type layout?

2005-04-28 Thread Peter A.Schott
I've got a file that seems to come across more like a dictionary from what I can tell. Something like the following format: ###,1,val_1,2,val_2,3,val_3,5,val_5,10,val_10 ###,1,val_1,2,val_2,3,val_3,5,val_5,11,val_11,25,val_25,967,val_967 In other words, different layouts (defined mostly by what

Re: Best way to parse file into db-type layout?

2005-04-29 Thread Peter A.Schott
That looks promising. The field numbers are pre-defined at the mainframe level. This may help me get to my ultimate goal which is to pump these into a DB on a row-by-row basis ( :-P ) I'll have to do some playing around with this. I knew that it looked like a dictionary, but wasn't sure how bes

Re: Difference between ActivePython and Python.org

2005-12-19 Thread Peter A.Schott
Amen to this one. Found out this after struggling with no SSL module when trying to write some secure FTP and HTTPS code. Downloaded the version from Python.org and it worked like a champ. I believe you can get both and have no issues with the install, though. For my part, I decided to standard

Problem with FTPLib and incomplete files on some downloads

2006-01-16 Thread Peter A.Schott
I download a lot of 4-6 KB files and regularly run into issues with files that don't get downloaded all the way or otherwise get corrupt. I do something like: RemoteList = nlstdir() for filename in RemoteList: LocalFile = open(filename, "wb") LocalFile.write( "get file code here" ) LocalFil

Re: MSSQL LIKE and IN statements in ADO problem

2006-01-18 Thread Peter A.Schott
Well, the raw TSQL would be: select * from tb_name where firstname like '%raj%' I think that would more translate to: name = "raj" cmd.CommandText = "SELECT * FROM tb_name WHERE firstname like '%%%s%%'" % name Perhaps issuing a print statement of the CommandText would help for future runs to de

Best way to capture output of another command-line program in Win32?

2006-02-06 Thread Peter A.Schott
Not sure what I should do here. I know that DOS/CMD can capture the output of EXE files in Win32. I know that os.popen() has been recommended for this, but the couple of times I've tried, it didn't seem to work well. I haven't had a lot of need to do this recently, but we're trying to automate s

Re: Best way to capture output of another command-line program in Win32?

2006-02-06 Thread Peter A.Schott
Thanks, I'll give this a try when I get a chance and will post back if we have any issues. -Pete "Grig Gheorghiu" <[EMAIL PROTECTED]> wrote: > subprocess gets my vote too. > > You can do something like: > > from subprocess import call, Popen, PIPE, STDOUT > > def run_cmd(cmd): > arglist =

Re: FTPlib

2006-02-13 Thread Peter A.Schott
Shouldn't that be: srcFtp.retrbinary('get ' + file[2:]) or some similar variation? You're also missing a block telling this where to write the local file. LocalFile = file.open(file[2:], "wb") LocalFile.write(srcFtp.retrbinary('get ' + file[2:]) ) (or something similar) -Pete "Harlin Seritt"

listdir() - any way to limit # of file entries?

2006-02-22 Thread Peter A.Schott
I want to build a program that does some archiving. We have several programs that have been dumping files into a folder (one folder) for some time now. I want to limit the number of files returned by listdir to avoid trying to build a list with tons of entries. I then want to move those files in

Re: Best way to parse file into db-type layout?

2005-05-03 Thread Peter A.Schott
Thanks for the comments. Quick notes: 1. Yes, ultimate goal is to output various fields into Excel, but I need to enter the data into a DB as well to avoid having any strange problems. That may be handled by a completely different process. I should have been more exact in saying that my current

Re: Alternative Ways to install Python 2.4?

2005-06-16 Thread Peter A.Schott
Not sure if this was ever resolved or not, but I've also had issues trying to install from a mapped drive. Once I copied the file locally and installed, it ran smoothly. -Pete Michael Goettsche <[EMAIL PROTECTED]> wrote: > On Monday 24 January 2005 00:29, "Martin v. Löwis" wrote: > > Michael Go

Re: Alternative Ways to install Python 2.4?

2005-06-17 Thread Peter A.Schott
Only thing I know to watch out for is they don't include SSL support - something the Python 2.4.1 msi file does include. I needed that for something I'm working on and had to install 2.4.1 over ActivePython to get the SSL support. -Pete David Van Mosselbeen <[EMAIL PROTECTED]> wrote: > James wr