Posts
 
Reputation
Joined
Last Seen
Ranked #2K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
86% Quality Score
Upvotes Received
15
Posts with Upvotes
12
Upvoting Members
11
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
2
3 Commented Posts
3 Endorsements
Ranked #486
Ranked #746
~67.4K People Reached

88 Posted Topics

Member Avatar for ihatehippies

I have a wx.DatePickerCtrl with the dropdown popup window that allows the user to pick a date from the calendar. What I would l like to have my program do is process an event when the user has clicked on a day in the dropdown calendar. Unfortunately the only native …

Member Avatar for gdtraveller
0
2K
Member Avatar for pwolf

look into time.strftime (string format time) [CODE=python] import time time.strftime("%a %m/%d/%y @ %H:%M:%S", time.localtime())[/CODE] returns 'Mon 01/23/12 @ 17:38:22' if you only wanted the time portion just do [CODE=python] time.strftime("%H:%M:%S", time.localtime())[/CODE] here is a reference for the meaning of each letter [URL="http://strftime.org/"]http://strftime.org/[/URL]

Member Avatar for Abhinav_4
0
3K
Member Avatar for ihatehippies

I stumbled on upon this anomaly in one of my programs and can't figure out why this is happening. I made a small test function that exhibits the same behavoir. It's like the local variables of my function are being saved after the function exits. The exclude_ids variable keeps growing. …

Member Avatar for james.lu.75491856
0
803
Member Avatar for ihatehippies

I'm soliciting advice for performace improvements for creating a weak checksum for file segments (used in the rSync algorithm) Here's what I have so far: def blockchecksums(instream, blocksize=4096): from hashlib import md5 weakhashes = [] stronghashes = [] for chunk in iter(lambda: instream.read(blocksize),""): a = b = 0 l = …

Member Avatar for ihatehippies
0
248
Member Avatar for bdheeraj

Do you have a file named DailyExpenses.py in the same folder. It is case sensitive.

Member Avatar for sneekula
0
579
Member Avatar for Frensi

Maybe I'm missing something, but how are you keeping time? You set clock_start, but I don't see the math to determine how much time has elapsed. I would expect something like clock_start = time.clock() time_elapsed = time.clock() - clock_start if time_elapsed > 2: ....(and so on)

Member Avatar for Sky Diploma
0
371
Member Avatar for ihatehippies

I came across this project that could be really helpful.. if I was c++ literate. I know enough c++ to be dangerous and thats about it. Thanks in advance for anyone who wants to take a crack at it. ps credit to: http://www.codeproject.com/Articles/13839/How-to-Prepare-a-USB-Drive-for-Safe-Removal

Member Avatar for Gribouillis
0
265
Member Avatar for vegaseat

if you want to drop everything after the last "." you would add this after line 39 file_name = ".".join(file_name.split(".")[:-1]) Here is a breakdown of that code file_name = "test.file.txt" file_name.split(".") <<< ["test", "file", "txt"] take a slice of that minus the last item in the list ["test", "file", "txt"][:-1] …

Member Avatar for leong87
2
8K
Member Avatar for crag0

if you google "monitor changes to folder python" the first link that comes up is http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html Pretty useful article

Member Avatar for TrustyTony
0
297
Member Avatar for utkarshsahu

Here's something that I use for similar purposes. (Note: I cannot take credit for the longest_common_sequence function and am too lazy to look up who actually created it, sorry.) Usage: >>> find_likeness(what='ardvark', where=['aardvark', 'apple', 'acrobat'], threshold=80.0, case_sensitive=True, return_seq=True, bestonly=False) [(93.33, 'aardvark', 0, 'ardvark')] ardvark is a 93.33% match with aardvark, …

Member Avatar for ihatehippies
0
237
Member Avatar for ihatehippies

I'm trying to create a wx.ListCtrl with a searchable header. I've been looking through the listctrl mixins, but I really don't have the wx expertise needed. I'm thinking I need to paint a textctrl using a dc object, but other than that I'm lost. Any ideas?

0
193
Member Avatar for ihatehippies

I'm doing some research to determine the most efficient way to copy files. I've got 3 candidate functions: #1 [CODE=python] # uses generator to load segments to memory def copy(src, dst, iteration=1000): for x in xrange(iteration): def _write(filesrc, filedst): filegen = iter(lambda: filesrc.read(16384),"") try: while True: filedst.write(filegen.next()) except StopIteration: pass …

Member Avatar for ihatehippies
0
6K
Member Avatar for KatseasSAvvas
Member Avatar for markusd5454
Member Avatar for floatingshed

To tell if a thread has finished it's assigned processing use [CODE] thread1 = ProcessThread(xyz) # # Then either from the main thread or from inside your second # thread run thread.isAlive() to check if the thread is still # running. The same principle as passing the arguments to the …

Member Avatar for floatingshed
0
376
Member Avatar for theLured

The code perfect for me. windows 7, python 2.7.2, wxpython 2.9.3.1 You can try updating wx or use the wx.CallAfter method which calls whatever you pass to it after the current event has finished processing. Maybe something like [CODE=python] def HideFrame(self, evt): self.Hide() wx.CallAfter(self.Wait) def Wait(self): time.sleep(1) self.Show() [/CODE]

Member Avatar for ihatehippies
0
2K
Member Avatar for kavithabhaskar

You question isn't very clear. Are you wondering about the print function? That is [URL="http://docs.python.org/release/2.5.2/lib/typesseq-strings.html"]string formatting[/URL].

Member Avatar for inuasha
0
118
Member Avatar for Thropian

I just dealt with this, asked for help in a post here but didn't get much help. It has to do with nat traversal which can be done from your computer. Hours of googling led me to uPnP. You have to forward public requests to your local (private) ip address. …

Member Avatar for ihatehippies
0
296
Member Avatar for KickAssElmo

So you have to create a unique file name with incremental values starting at 1. First thing you gotta do it separate the file from the folder. os.path is going to be your friend for this one [CODE=python] from os import path # get the absolute path file_path = path.abspath(file_path) …

Member Avatar for ihatehippies
0
250
Member Avatar for aharrisii

Hard to check your syntax unless you put your code in code blocks because we can't see the indents. Change 'random.randit' to 'random.randint' x 2. Change 'myrole = (diceroll + diceroll2)' to 'myrole = (diceroll[I][B]1[/B][/I] + diceroll2)' As written this will not play until the pot is empty. Consider adding …

Member Avatar for rny5
0
2K
Member Avatar for floatingshed

I think you'll find that most people hate using globals. I would probaly add an argument to the __init__ method to accept the args: [CODE=python] def __init__(self, args): self.args = args[/CODE] and then simply pass those saved arguments in your 'run' method. [CODE=python] def run(self): os.system(self.args)[/CODE] Just pass the args …

Member Avatar for floatingshed
0
147
Member Avatar for vimtojoe

To get you started [CODE] pw = '' while len(pw) < 6: pw = raw_input('Please enter a password at least 6 characters long\n') if len(pw) < 6: print('The password needs to be 6 characters long, not (%s)'%len(pw)) raw_input('Good Job!!!!!')[/CODE]

Member Avatar for ihatehippies
0
206
Member Avatar for ulxlx

[url]http://docs.python.org/tutorial/[/url] basically there are 2 ways to run a python file. Via command line interface or via python's built in IDLE. Python will be installed at c:\python27. At c:\python27\lib you will find python's standard library, a bunch of .py files that give the user python's famed functionality. If you right …

Member Avatar for ulxlx
0
335
Member Avatar for new2pyp

it would probably look something like this [CODE=python] # untested x = 1000 with open(path, 'rb') as fileobj: data = [x.strip().split(' ') for x in fileobj.readlines()] total_rows = len(data) for n in xrange(1, total_rows): first = int(data[n-1][0].strip()) second = int(data[n][0].strip()) print (second-first)/x [/CODE]

Member Avatar for ihatehippies
0
184
Member Avatar for layneb131

What are you using the 'user' variable for? You should use raw_input to set the 'text' variable and if you want it to be called more than once you have to put it inside the while loop.. something like this: [CODE=python] total = 0 text = '' while text != …

Member Avatar for TrustyTony
0
1K
Member Avatar for knnchau

tested on python 2.7.2 [CODE=python] import random def guessing(): start = int(raw_input('enter the starting number\n')) stop = int(raw_input('enter the ending number\n')) while start < stop: guess = random.randint(start, stop) answer = '' while answer not in ('higher', 'lower', 'equal'): answer = raw_input('Is it higher, lower, or equal to %s\n'%guess) if …

Member Avatar for knnchau
0
200
Member Avatar for python-noob

strip removes those characters from the left and right sides of the string. If the character occurs in the middle of the string it will have no effect on it. This is what I use to remove duplicate characters from a string [CODE=python] def Unduplicate(string, chars): for char in chars: …

Member Avatar for ihatehippies
0
247
Member Avatar for Matjame

It would have been more helpful if you copied the actual traceback, but it looks like in your code: [CODE=python]def updateprimepage(): try: import urllib cobdate = string.replace(sys.argv[1], '-', '') f = urllib.urlopen('http://xxx.xx.xx.xxx:18080/optionupload/OptionReportOndemandServlet?dirpath=%%2Fexport%%2Fdata%%2Fgpfs%%2Freports%%2FSAReport&cobdate=%s&submit=submit&operation=submit' %cobdate) print f.read() except IOError: print 'Cannot open URL %s for reading' % f[/CODE] If an IOError is …

Member Avatar for woooee
0
2K
Member Avatar for floatingshed

string formatting [CODE=python] path = 'c:\\aPath' arg1 = 'an argument' arg2 = 6 '%s "%s" %s' % (path, arg1, arg2) # returns 'c:\\aPath "an argument" 6[/CODE] %s tells python you want to insert something into the string It replaces every occurrence of %s with what you supply it with in …

Member Avatar for woooee
0
287
Member Avatar for ihatehippies

Just wanted to point out for anyone using py2exe that it apparently doesn't always (or maybe ever) raise AssertionErrors. It's been a while since they've updated the program so it's probably just easier to implement a workaround for those of us who use this compiler. I've noticed it not raising …

0
100
Member Avatar for pxalpine

to get you started... *untested [CODE] import os for name in os.listdir(aDirectory): if not name.lower().endswith('.html'): continue with open(os.path.join(aDirectory, name), 'rb') as fileobj: output = [line.replace("Paragraph", "Absatz") for line in fileobj.readlines() if not "embed_music" in line] with open(os.path.join(aDirectory, name), 'wb') as fileobj: fileobj.write(''.join(output)) [/CODE] You may want to create a backup …

Member Avatar for ihatehippies
0
166
Member Avatar for apeiron27

*untested [CODE=python] dic = {ric:24, ric1:46, ric2:23, mike:1, mike1:47} values = [v for k, v in dic.items() if 'ric' in k or 'mike' in k] [/CODE]

Member Avatar for snippsat
0
74
Member Avatar for scott_liddle

You just have to describe the format to python. You are looking for 3 items separated by a comma. The third item is a digit and the second item is a 3 letter month. *Note: Code is untested [CODE] print "You chose to add a new birthday" with open('birthdays.txt', 'r') …

Member Avatar for ihatehippies
0
225
Member Avatar for MasterHacker110

if you end up using threads make sure the threads exit. I've ran into that error a few times only to find an extra instance of python.exe running in the background because a thread never exited.

Member Avatar for ihatehippies
0
5K
Member Avatar for floatingshed
Member Avatar for Gribouillis
0
272
Member Avatar for bkribbs

This is what I've used in the past [CODE=python] import os os.system('start "" "%s" False' % path) [/CODE] start executes the file "" is the name of the console window %s is the path to the fie and False was an argument passed to the exe

Member Avatar for ihatehippies
0
138
Member Avatar for TF401

I would look into SendKeys [URL="http://www.networkautomation.com/automate/urc/resources/help/instructions/Sbe6_000SendKeys_Instruction.htm"]Here[/URL] or [URL="http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm"]Here[/URL] The code is pretty straightforward [CODE=python] from win32com.client import Dispatch SendKeys = Dispatch("WScript.Shell").SendKeys # then to actually send a key SendKeys('a') [/CODE] Here is an answer related to getting the title of currently opened windows: [URL="http://mail.python.org/pipermail/python-win32/2008-December/008510.html"]here[/URL]

Member Avatar for ihatehippies
0
356
Member Avatar for ihatehippies

I've been working with python's SocketServer.ThreadingTCPServer a bit and I'm having some difficulty making a publicly available server. Everything works fine when I set the server address as 'localhost' [CODE=python]self.server = SocketServer.ThreadingTCPServer(('localhost', constants.cmdport), Handler)[/CODE] As long as the both the server and client are on the same computer and both …

Member Avatar for ihatehippies
0
7K
Member Avatar for pwolf

[CODE=python]def isprime(num): for x in range(2, num): if num % x == 0: return False return True[/CODE]

Member Avatar for pwolf
0
465
Member Avatar for drlockdown

delete everything above "import random" in the picture you posted. also use code tags when posting here it helps people run your code when they're testing it (press the code button and put [CODE=python] on the first code block. Instead of input() I would use [CODE=python]answer = raw_input('ask a question …

Member Avatar for snippsat
0
194
Member Avatar for dolphinaura

I don't understand completely what you're trying to do so this might not be helpful at all, but I feel bad cuz no one's tried to give you an answer. you would need to make another class to save the attribute 'contents' [CODE=python] class container(object): pass class CustomError(Exception): def __init__(self): …

Member Avatar for griswolf
0
112
Member Avatar for Plastico Bolha

Simple way to do this is to put the program or a shortcut to it here C:\\Users\\*USERNAME*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup where *USERNAME* is your username

Member Avatar for Plastico Bolha
0
68
Member Avatar for ihatehippies

I made a simple ThreadManager class that receives tasks and spawns threads to complete the tasks. Currently it keeps all the threads alive until I explicitly set threadmgr.waiting=False and all of the tasks are complete. I'm trying to eliminate the need for the former. What I would prefer is that …

Member Avatar for ihatehippies
0
176
Member Avatar for ihatehippies

Currently running python 2.7 on windows 7. I have an app created with wx python and compiled with py2exe. This app has an update utility that polls an update server at startup. If an update is found it downloads the new executable file (approx. 7mb) and makes the switch. It …

0
131
Member Avatar for ihatehippies

how do I catch changes to a mutable object ie: [CODE=python] class test(object): def __init__(self): self.x = [] def __getattr__(self, atr): print 'retrieving atr %s' % atr return self.__dict__[atr] def __setattr__(self, atr, val): print 'setting atr %s to value % s' % (atr, val) self.__dict__[atr] = val [/CODE] >>> instance …

Member Avatar for ihatehippies
0
229
Member Avatar for ihatehippies

Anyone work with UltimateListCtrl's before? I'm looking for a way to dynamically change the column headers background color.

0
108
Member Avatar for ihatehippies

I'm having a hard time getting my website to email the contents of form. It will send an email with the field labels but no values.. ie name: phone number: email: from: () the only thing I can get it to return is the ip Here is the relevant html …

0
66
Member Avatar for ihatehippies

How do you keep a wx frame from not responding while the code is running in the background? ie a search or other demanding function.

Member Avatar for ihatehippies
0
913
Member Avatar for Brickmack

you can try os.startfile to start any sound file or if you're making a gui app you can try wx.Sound or wx.SoundFromData to play a .wav file

Member Avatar for woooee
0
78
Member Avatar for ihatehippies

why does this fail to call any event? [CODE=python] def StartTimer(self, timer = 1): timer_data = { 1: (self.TimeKeeper, False, 50), 2: (self.InterimSearch, True, 200), 3: (self.InterimCurSearch, True, 200), 4: (self.SetOpaque, False, 50), 5: (self.DisplayPhoto, True, 200) } function, singlefire, time = timer_data[timer] timer = str(timer) # class of constants …

0
151

The End.