Re: ImageMagick Issue

2007-05-31 Thread Sick Monkey
name [No such file or directory]. Traceback (most recent call last): On 5/31/07, Facundo Batista <[EMAIL PROTECTED]> wrote: Sick Monkey wrote: > When I run the following command: > [EMAIL PROTECTED] david.huggins]# identify -format %w > '/someDIR/images/david.huggins/100_026

file uploader

2007-05-09 Thread Sick Monkey
Hey guys. I wanted to write a little desktop application that would upload files to an external server, to a specific directory. The desktop application is running on Mac OS X and I built a .psp script that is running on a Red Hat server. NOTE: This application is written for Python 2.5 (both p

Re: append

2007-05-10 Thread Sick Monkey
http://docs.python.org/tut/node7.html Yes there is a pop function. "An example that uses most of the list methods: a = [66.25, 333, 333, 1, 1234.5] print a.count(333), a.count(66.25), a.count('x') 2 1 0 a.insert(2, -1) a.append(333) a [66.25, 333, -1, 333, 1, 1234.5, 333] a.index(333) 1

Re: file uploader

2007-05-13 Thread Sick Monkey
name,i) else: t = i-1 filename=string.replace(filename,".-%s" % (t),".-%s" % (i)) i += 1 req.write(filename) %> The directory contains the following files: "whoa.mp3" and "whoa.mp3.-0". This code will output "whoa.mp3.-1". On 5/9/07,

wxpython - button question

2007-05-18 Thread Sick Monkey
I have the following code which will basically take an image file and create a bitmap image. I am having one problem though in that there is a white border around the image. Does anyone know how to take that off? imageFile2 = "image.png" image2 = wx.Image(imageFile2, wx.BITMAP_TY

interesting dict bug

2007-05-19 Thread Sick Monkey
Here is a segment of some code that I have. CODE: -- print filename params2 = {'filename':filename,'id3title':title,'id3artist':artist,'id3album':album,'id3year':year,'id3track':track,'id3genre':genre,'uname':username,'password':password,'filesToUpload':open(file, 'rb')} print pa

Re: interesting dict bug

2007-05-19 Thread Sick Monkey
rmation. >>> s = "string" >>> unicode(s) u'string' >>> You're not seeing the 'u' in the 'print filename' line as it isn't actually part of the data. You will see it in the 'print params2' output, though, as

Re: py2exe compiling

2007-05-22 Thread Sick Monkey
Have you looked at the "Tips and Tricks" on Py2exe's website? http://www.py2exe.org/index.cgi/GeneralTipsAndTricks I believe this next link will help you add custom data to your app. http://www.py2exe.org/index.cgi/CustomDataInExe .dave On 5/21/07, Pyro <[EMAIL PROTECTED]> wrote: Hello, I ha

ImageMagick Issue

2007-05-30 Thread Sick Monkey
I have the following: OS = RedHat ImagMagick installed. Python v2.5 - When I run the following command: [EMAIL PROTECTED] david.huggins]# identify -format %w '/someDIR/images/david.huggins/100_0264.JPG' I get the following result 2304 However, when I try

POP3 - Saving an image attachment only.

2007-08-27 Thread Sick Monkey
I wrote some code below (Code1 block) which will read a pop3 email account and will open each email in the inbox. What I want my code to do is only pull the attachment; as you see below I basically output everything. Is there an easy way to just pull attachments? (NOTE, the only attachements that

Re: py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread Sick Monkey
(1) You may want to read the following links: http://docs.python.org/dist/describing-extensions.html#SECTION00234 which came from: http://docs.python.org/dist/dist.html Here is another good resource for py2exe: http://www.py2exe.org/index.cgi/GeneralTipsAndTricks (2) Also, you

Re: SQLAlchemy and Oracle Functions?

2007-03-08 Thread Sick Monkey
Helpful Links http://sourceforge.net/projects/cx-oracle http://www.python.net/crew/atuining/cx_Oracle/html/cursorobj.html == Example: Replace the data types as appropriate. v_Vars = v_Cursor.setinputsizes(p_Result = cx_Oracle.NUMBER) v_Cursor.execute(""" begin

Re: What is the best way to upgrade python?

2007-03-08 Thread Sick Monkey
Have you tried to upgrade the current python RPM? rpm -Uvh You can also build from source. Once you get Python 2.4 up and running I am pretty sure you can do a symbolic link on the python 2.3 application (either in /usr/bin or /usr/sbin) and point it to the 2.4 python file. On 8 Mar 2007

Re: What is the best way to upgrade python?

2007-03-08 Thread Sick Monkey
be distressed if you need to update or install new RPMs. On 3/8/07, ying lcs <[EMAIL PROTECTED]> wrote: On 3/8/07, Sick Monkey <[EMAIL PROTECTED]> wrote: > Have you tried to upgrade the current python RPM? > > rpm -Uvh > > You can also build from source. Onc

Re: making an "executable" for a python code (newbie)

2007-03-10 Thread Sick Monkey
You will probably want to read this documentation: http://pyinstaller.hpcf.upr.edu/docs/Manual_v1.1.html Look carefully at the following sections on the documentation: "Building the runtime environment" and "Spec File" and "Spec File -> EXE"

Re: Readline()

2007-03-12 Thread Sick Monkey
Maybe if you show us your code we can better assist you. But maybe you can use a global variable or a try-catch method to keep threads from staying alive and help better control your code. On 3/12/07, Taylor, Stuart <[EMAIL PROTECTED]> wrote: I have been working on running an external process

Re: Python shell on mac os x

2007-03-15 Thread Sick Monkey
I use iTerm and it took me a while to get use to it as well. All you have to do is go to "Bookmarks-> Manage Profiles" Then expand "Terminal Profiles ->Default" and then for "type" select "linux". You may have to restart iTerm, but you will be able to do everything you can in linux. Let me kno

Re: Python Eggs on Cygwin

2007-03-15 Thread Sick Monkey
Just by looking at the "permission denied" error, when you loaded the MySQLdb module, were you using a specific user (is it owned by a specific user)? On 15 Mar 2007 17:33:29 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi, I'm trying to use MySQL Python module on Cygwin. Since there

Re: Looping issues

2007-04-05 Thread Sick Monkey
Try this. NOTE: The script below will compare lines of both files (even hidden characters such as \n)... def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fnam

Re: Looping issues

2007-04-05 Thread Sick Monkey
fname + ": " + str(detail)) f1 = fopen('file1.txt') a = f1.readlines(); f1.close() d1 = {} for c in a: d1[c.lower()] = None #print d1 f2 = fopen('file2.txt') data = f2.readlines(); f2.close() for line in data: if d1.has_key( line.lower()

Re: Cascading ifs

2007-04-05 Thread Sick Monkey
If it is just the indentation that is bothering you, you could do this: match = "test" if match == "1": print "1" elif match == "2": print "2" elif match == "test": print "test" On 4/2/07, Ernesto García García <[EMAIL PROTECTED]> wrote: Hi experts, How would you do this without the

Re: recursively removing files and directories

2007-04-09 Thread Sick Monkey
Here is some code that could be useful It does not check the directories for 0 files, but that shouldn't be too difficult to add. # from os import listdir, unlink from os.path import isdir, isfile, islink, join, getmtime deldir = "C:\Some\Dir" delF

difflib qualm

2007-01-24 Thread Sick Monkey
I am trying to write a python script that will compare 2 files which contains names (millions of them). More specifically, I have 2 files (Files1.txt and Files2.txt). Files1.txtcontains 180 thousand names and Files2.txt contains 34 million names. I have a script which will analyze these two file

Re: Diff between opening files in 'r' and 'r+' mode

2007-01-30 Thread Sick Monkey
It was a little hard to follow your logic of your sample code (writing, reading and writing again), but (1)The difference between r and r+. - 'r+' opens the file for both reading and writing. - 'r' should be used when the file will only be read. I am not sure on how you want to store the co

Re: Synchronous shutil.copyfile()

2007-01-30 Thread Sick Monkey
First off, I am just learning Python, so if there is a more efficient way to do this, then I am all ears (NOTE: The code below is something that I was messing with to learn threads... So some functionality is not applicable for your needs..I just wanted to show you a demonstration) One way

Re: PYTHONPATH or any other way to set seachpath (winXP) ?

2007-02-03 Thread Sick Monkey
If you need to extend your PATH variable, I have used this in the past. ~~ def AddSysPath(new_path): new_path = os.path.abspath(new_path) do = -1 if os.path.exists(new_path): do = 1 # check against all paths currently available

Dictionary/Hash question

2007-02-06 Thread Sick Monkey
Even though I am starting to get the hang of Python, I continue to find myself finding problems that I cannot solve. I have never used dictionaries before and I feel that they really help improve efficiency when trying to analyze huge amounts of data (rather than having nested loops). Basically w

Re: Dictionary/Hash question

2007-02-06 Thread Sick Monkey
/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Tue, 06 Feb 2007 20:31:17 -0300, Sick Monkey <[EMAIL PROTECTED]> escribió: > Even though I am starting to get the hang of Python, I continue to find > myself finding problems that I cannot solve. > I have never used d

Re: Dictionary/Hash question

2007-02-06 Thread Sick Monkey
t; wrote: En Tue, 06 Feb 2007 22:18:07 -0300, Sick Monkey <[EMAIL PROTECTED]> escribió: > I have never seen this "with open(fname,'r') as finput:" > > It is actually throwing an error . Do I have to import a special > library to > use this? &

Dictionary Question

2007-02-08 Thread Sick Monkey
Hello All. I have a question concerning searching data within dictionaries. Lets say I have a dictionary called db. db = {'[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none',} And I want to pull out all of the "gmail.com" addresses..

Python Threads

2007-02-18 Thread Sick Monkey
Is there anyway to get 2 python threads to talk to one another? I have a GUI which is spawning a thread to make a large calculation (that way the GUI does not appear to be non responsive). I am trying to attach a progress bar to the threaded action. As the thread is calculating data, I would li

Re: Python Threads

2007-02-18 Thread Sick Monkey
Well if this cannot be done, can a thread call a function in the main method? I have been trying and have not been successive. Perhaps I am using thread incorrectly. On 2/18/07, Sick Monkey <[EMAIL PROTECTED]> wrote: Is there anyway to get 2 python threads to talk to one another? I

Re: Python Threads

2007-02-19 Thread Sick Monkey
Great, thanks for the tip Gabriel! On 2/18/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Sun, 18 Feb 2007 23:37:02 -0300, Sick Monkey <[EMAIL PROTECTED]> escribió: > Well if this cannot be done, can a thread call a function in the main > method? > I have been try

Re: Regd. converting seconds to hh:mm:ss format

2007-02-20 Thread Sick Monkey
Do you mean epoch time? if so, the below example would work. import time,datetime t = datetime.datetime.now() print t 2007-02-20 13:09:34.851000 print "Epoch Seconds:", time.mktime(t.timetuple()) Epoch Seconds: 1171994974.0 # go the other way epochtime = 1171994974 now = datetime.datetime.

Re: Python Threads

2007-02-22 Thread Sick Monkey
adStat while threadStat == 0: pass ### def openMax(): a = tkFileDialog.askopenfilename() listName[0] = a def openEmail(): b = tkFileDialog.askopenfilename() listName[1] = b def openDomain(): c = tkFileDialog.askopenfilename() listName[2] = c #

Re: getting info on remote files

2007-02-26 Thread Sick Monkey
You should use os.popen() instead of os.system. os.popen() will return a file-like object that is connected to the stdout of the system command; you can then use that object's read()/readlines() method(s) to assign that output to a Python variable. http://docs.python.org/lib/module-popen2.html

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Sick Monkey
I had a do something similar. I had to get a program to traverse through a directory and delete all files with a specific file extension. (The program below will delete files, so I do not recommend you running it without paying close attention to it.) This program will start at a given director

Re: os.system and quoted strings

2007-02-27 Thread Sick Monkey
Do you mean: import time, os dir = "C:\\Documents and Settings\\somepath\\" fileName = time.strftime("%d%m%Y") finalname = "%s%s.txt" % (dir,fileName) print finalname C:\Documents and Settings\somepath\27022007.txt On 27 Feb 2007 06:24:41 -0800, svata <[EMAIL PROTECTED]> wrote: Hello, as I

Re: book for a starter

2007-02-27 Thread Sick Monkey
I personally would get "Programming Python, Third Edition " http://www.oreilly.com/catalog/python3/ On 2/27/07, Wensui Liu <[EMAIL PROTECTED]> wrote: Good morning, all, I just start learning python and have a question regarding books for a newbie like me. If you are only allowed to buy 1 pyt

Special Characters

2007-02-27 Thread Sick Monkey
I have a quick question about handling values with special characters. Lets say I have a file which contains: == blah#blah == Here is what I have for my code: f6 = open(fileAttached) msInfo = f6.readlines(); f6.close() varNam

Re: Special Characters

2007-02-27 Thread Sick Monkey
finName = varName.strip() On 2/27/07, Sick Monkey <[EMAIL PROTECTED]> wrote: I have a quick question about handling values with special characters. Lets say I have a file which contains: == blah#blah == Here is what I have fo

Py2EXE problem

2007-02-27 Thread Sick Monkey
Maybe this is not the board to post this, but hopefully with all of the python experts out there maybe one of you have encountered this. I wrote an application that sends an email with an attachment. When I run it, it runs great with no issues what-so--ever. When I thought I was finally finish

Re: Py2EXE problem

2007-02-28 Thread Sick Monkey
.pyc that my application needed and inserted them in the "email folder" within the library.zip. I fired up the application and it worked like a champ. On 2/27/07, Sick Monkey <[EMAIL PROTECTED]> wrote: Maybe this is not the board to post this, but hopefully with all of the pyth

Re: Py2EXE problem

2007-02-28 Thread Sick Monkey
Awesome. That is good to know. On 2/28/07, Thomas Heller <[EMAIL PROTECTED]> wrote: Sick Monkey schrieb: > Ok I found an extremely easy way to resolving this issue (I cannot believe I > did not think of it sooner). > > After Py2exe created the .exe file I noticed a "lib

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Sick Monkey
Here you are: >>> from win32com.client import GetObject wmiObj = GetObject("winmgmts:MGW01641\\root\\cimv2") diskinfo = wmiObj.ExecQuery("Select * from Win32_LogicalDisk") for disk in diskinfo: ...print disk.Name, disk.FreeSpace ... A: None C: 16978259968 D: None On 28 Feb 2007 12:2

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Sick Monkey
Sorry, I forgot to make a change. You will need to change "COMPUTER_NAME" ~~~ >>> from win32com.client import GetObject wmiObj = GetObject("winmgmts:COMPUTER_NAME\\root\\cimv2") diskinfo = wmiObj.ExecQuery("Select * from Win32_LogicalDisk") for disk in dis

Re: text wrapping help

2007-02-28 Thread Sick Monkey
I am not certain if I understand your problem, but I think you are just trying to read in a string and create a visable matrix. If that is true, then may some of the code below will work. This is in no way elegant. ++ count = 1 width = 2

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread Sick Monkey
I have just gotten into pyHook, so I could be incredibly wrong, but I have researched a lot into your problem. (cuz I have the same question) I think the python program has to be on the remote machine becuase from my understanding pyHook just reads in the windows' keyboard driver. And when you

Python win32 tools

2007-03-01 Thread Sick Monkey
I am trying to build a python program that will reset a user's account (password) on a windows machine (NOTE: my intention here is not to implement anything malicious {and I know about Trinity which is very useful}, but I just wanted a challenge and do it myself.). I have been working with win32

WXPython - Using inline images

2008-01-01 Thread Sick Monkey
I have a question about WXPython and using inline images. The code that I have included into this email comes from the following URL: http://www.daniweb.com/code/snippet654.html As you can see from the code below, that this application will take an inline JPG image, and will create a loca

CDA conversion

2008-01-31 Thread Sick Monkey
Good evening. I am trying to write an application in Python that will allow a person to insert a CD into their computer and this python script will convert the music to mp3. NOTE: I have already google'd this, and nothing really pops out at me. I found tons of applications that does this, but I