convert string number to real number - ValueError: invalid literal for int() with base 10: '2'

2008-02-28 Thread davidj411
i am parsing a cell phone bill to get a list of all numbers and the total talktime spend on each number. i already have a unique list of the phone numbers. now i must go through the list of numbers and add up the totals for each number. on the bill, each line has a few fields,one field containing

change user-agent

2008-03-05 Thread davidj411
I came across this post on the net and wanted to know what was meant by down-level module. So, how can we change the User-Agent? If we don't want to change the headers using a lower-level module such as httplib, the solution is quite easy --

Re: documenting formal operational semantics of Python

2008-03-05 Thread davidj411
Python 3.0 might end up better, but converting all those scripts will be a chore. I'd be curious to know how that will be done. -- http://mail.python.org/mailman/listinfo/python-list

lowercase u before string in python for windows

2008-03-10 Thread davidj411
why does this occur when using the python windows extensions? all string are prefixed by a lowercase u. is there a newsgroup explicitly for python windows extensions? example of output below. SMBIOSBIOSVersion:u'A16' SMBIOSMajorVersion:2 SMBIOSMinorVersion:3 SMBIOSPresent:True

difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread davidj411
anydbm and dictionary{} seem like they both have a single key and key value. Can't you put more information into a DBM file or link tables? I just don't see the benefit except for the persistent storage. d= dbm.open('c:\\temp\\mydb.dat','n') It has the following interface (key and data are

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread davidj411
Persistent storage /is/ the benefit. If you want to store relational data, you should use a relational database. Thanks, that makes sense. Are there any local relational databases available to python that don't require a server backend? -- http://mail.python.org/mailman/listinfo/python-list

FTP upload issue

2008-05-15 Thread davidj411
I am having difficulty uploading a text file using Python 2.5 on MAC OSX. SCRIPT filename='/tmp/mac.info2.txt' fh=open(filename,'w') fh.write('yes, i have a mac but don't hold that against me - just example data') fh.close() from ftplib import FTP 'host, username, and password are string

IIS python web application mapping issue - resolved

2009-04-03 Thread davidj411
i searched the internet for an hour , never found this info, and figured it out myself. posting this so that others won't have to look so hard. ran across this issue and it seems that nobody really documented this correctly on http://support.microsoft.com/kb/276494 in IIS i could not add the

Re: IIS python web application mapping issue - resolved

2009-04-03 Thread davidj411
I thought i was being clever but not only did i typo , but it does not work with the -u for unbuffered option. remove the -u to avoid the ugly message: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. I am going to use the CGI script to upload

cgi file limit size?

2009-04-06 Thread davidj411
I am wondering where the limitation of filesize comes from when i upload a large file. it uploads when the filesize is less than 20 MB (but not if larger). the script does not limit the filesize so it is either an HTTP specification or a webserver limit, right? maybe my connection to the server is

Re: cgi file limit size?

2009-04-09 Thread davidj411
i am using these modules: import cgi,time import cgitb; cgitb.enable() iis webmapping now works with -U (key was to remove '-u' from the grouping of s's: C:\Python25\python.exe -u %s %s here is the form html code: form action=upfile.py method=POST enctype=multipart/form- dataServer name:INPUT

function returns , but variable values has not changed in the interactive prompt

2008-05-23 Thread davidj411
if you run execfile function to run a python script and that script has variables and functions, should't those variable change in the interactive prompt too? script snippet that calls the function which should return like this return (stuffedname,bigstring,

csv iterator question

2008-05-23 Thread davidj411
When you save an open file to a variable, you can re-use that variable for membership checking. it does not seem to be that way with the csv.reader function, even when set to a variable name. what is the best way to store the open CSV file in memory or do i need to open the file each time?

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '2'

2008-05-28 Thread davidj411
On May 28, 2:22 am, Kam-Hung Soh [EMAIL PROTECTED] wrote: David Jackson wrote: i used the csv module and saved its contents to a list. ['Date', 'No.', 'Description', 'Debit', 'Credit'] ['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45'] ['3/04/2007', '5678', 'THE HOME DEPOT 263

sublassing as a verb

2008-06-20 Thread davidj411
docs on urllib module say this about the FancyUrlOpener: class FancyURLopener( ...) FancyURLopener subclasses URLopener providing default handling for ... does that mean the FancyURLopener is a subclass of URLopener? -- http://mail.python.org/mailman/listinfo/python-list

Using Python Scripts with IIS - ASP or Python-based CGI scripts with IIS - which makes more sense?

2008-06-27 Thread davidj411
when does is make sense to use a ASP style Page (.psp) over a Python- based CGI script with IIS. ? http://support.microsoft.com/kb/276494 ASP requires registering the python engine. which has better performance? The ASP style uses a new part of the python language which is unfamiliar to me,

asp versus cgi

2008-11-26 Thread davidj411
when i use cgi, i never get a 500 error but i can see how it might take on overhead if many users are hitting the site at once. so to avoid this, i looked into registering the python engine for ASP requests. when i use asp (C:\WINDOWS\system32\inetsrv\asp.dll fileversion info:--a-- W32i DLL ENU

asp oddness , why specify ASP twice

2008-11-26 Thread davidj411
for some reason this code works: * %@ LANGUAGE = Python% % Response.Write (test) % * but this code does NOT: * %@ LANGUAGE = Python Response.Write (test) %

best performance for storage of server information for python CGI web app?

2009-11-18 Thread davidj411
I am wondering what will give me the best performance for storing information about the servers in our environment. currently i store all info about all servers in a single shelve file, but i have concerns. 1) as the size of the shelve file increases, will performance suffer ? 2) what about if 2

sqlite3 .mode option to create HTML table automatically?

2009-12-22 Thread davidj411
the CLI for sqlite3 shows .mode of html, which formats the output in HTML format that is good to add to TABLE. BUT i have not yet found anything for sqlite in python that does this. in fact, i found an old post saying 'if you want the output in a table, you must create it yourself'. Does anyone

multivariable assignment

2009-12-31 Thread davidj411
I am not sure why this behavior is this way. at beginning of script, i want to create a bunch of empty lists and use each one for its own purpose. however, updating one list seems to update the others. a = b = c = [] a.append('1') a.append('1') a.append('1') c ['1', '1', '1'] a ['1', '1',

WMI remote call in python script to create process on remote windows computer

2009-10-06 Thread davidj411
import win32com.client computer = server strUser = server\user_name strPassword =my_password objSWbemLocator = win32com.client.Dispatch (WbemScripting.SWbemLocator) objSWbemServices = objSWbemLocator.ConnectServer(computer, root \cimv2,strUser,strPassword) objCreateProc =

time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-21 Thread davidj411
I am using a recursive function to print the time and a few other things on each pass. ( the function calculates size of file that is being transferred and if not 100 % copied, it waits 20 secs and checks again). i would expect the time to be correct anytime it is used: --code below -- print

Re: time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-21 Thread davidj411
On Jul 21, 5:29 pm, Simon Forman sajmik...@gmail.com wrote: On Jul 21, 5:00 pm, davidj411 davidj...@gmail.com wrote: I am using a recursive function to print the time and a few other things on each pass. ( the function calculates size of file that is being transferred and if not 100

Re: time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-22 Thread davidj411
i never heard of the logging module, but this function seemed simple enough. i assume this link is what you refering to: http://docs.python.org/library/logging.html thanks for the helpful info. i think Piet van Oostrum has resolved my issue. good eyes! --

Re: how can a child thread notify a parent thread its status?

2009-07-27 Thread davidj411
could i see an example of this maybe? -- http://mail.python.org/mailman/listinfo/python-list

possible to run a python script without installing python?

2011-03-15 Thread davidj411
it seems that if I copy the python.exe binary and the folders associated with it to a server without python, i can run python. does anyone know which files are important to copy and which can be omitted? i know about py2exe and have had no luck with it. --

Re: AIX installation can't find zlib

2011-11-03 Thread davidj411
we using RPM to install python 2.7.x and same issue there, can't import gzip b/c zlib is missing. we used RPM to install zlib, but did not effect python. you mentioned modules and uncommenting something. could you be more specific? also , we are not compiling. would that be required for python