15,406 Topics

Member Avatar for
Member Avatar for cableguy31

I'm writing a script that will search files that contain certain keywords, and then output the line to a text file. The problem I'm having is that the script is opening every type of file, including executables. The script seems to work fine, as in it doesn't crash when it …

Member Avatar for cableguy31
1
747
Member Avatar for phalaris_trip

how do I launch a python script within the IDLE python shell from the command line? basically I want to use Notepad++ as my editor, but when I press F5 I want my script to run in the IDLE python shell (NOT in a cmd window). If I do C:\Python26\Lib\idlelib\idle.pyw …

Member Avatar for phalaris_trip
0
203
Member Avatar for TrustyTony

This is must read if you learned Java before Python: Python Is Not Java: [url]http://dirtsimple.org/2004/12/python-is-not-java.html[/url]

Member Avatar for snippsat
1
654
Member Avatar for Jeramy

Be aware this is going to be ugly because I have never written anything in python and am attempting to quickly pick up just enough to solve my problem. I need a way to automate doing about 2 weeks of daily archives of a backup file. I think I have …

Member Avatar for Jeramy
0
110
Member Avatar for echellwig

Hi, I'm looking to break up a file with space delimiters. Its really just a list of numbers with spaces in between them, and I need to put each of the numbers in a list as separate entries. However, they are all on one line like so: 5 7 6 …

Member Avatar for echellwig
0
180
Member Avatar for lewashby

[CODE]from Tkinter import * import pygame.mixer sounds = pygame.mixer sounds.init() correct_s = sounds.Sound("Correct.wav") wrong_s = sounds.Sound("Wrong.wav") number_correct = 0 number_wrong = 0 def play_correct_sound(): global number_correct number_correct = number_correct + 1 correct_s.play() def play_wrong_sound(): global number_wrong number_wrong = number_wrong + 1 wrong_s.play() app = Tk() # creat a tkinter application …

Member Avatar for SgtMe
0
354
Member Avatar for capson

Hello, I am trying to sum lists if a condition is met, not working, not sure why, I end up with PN=[0,0,0,0,0,0,0,0] which is it's initial condition and should be PN=[1,1,1,1,0,1,1,1] as PN0 and PN1 satisfy the condition PNi.count(1)<2, so PN+PN0+PN1 = [1,1,1,1,0,1,1,1]. Thanks. [CODE]>>> PN0=[0,0,1,1,0,1,0,1] PN1=[1,1,0,0,0,0,1,0] PN2=[0,0,0,0,1,0,0,0] PN=[0,0,0,0,0,0,0,0] NULL==[0,0,0,0,0,0,0,0] …

Member Avatar for capson
0
118
Member Avatar for cableguy31

As I started to mention in this thread [URL="http://www.daniweb.com/forums/thread293034.html"]Checking for filetypes?[/URL]: I'm writing a script that will search files that contain certain keywords, and then output the line to a text file. The problem I'm having is that the script is opening every type of file, including executables. The script …

Member Avatar for woooee
0
133
Member Avatar for vegaseat

The wxPython GUI toolkit makes a very nice plotting component/widget available. You can select line or marker plotting, or a combination of both. All you have to supply is a list of x,y point tuples. Other features include zooming and printing.

Member Avatar for aernie
1
2K
Member Avatar for gangster88

atlast I have managed to get some working code but the first problem is that I have is taht.. when I call draw(2,4) I have a column of 2 circles and 4 rows and I would actually like it to be a clomun of 2 and row of 4. Secodly …

Member Avatar for gangster88
0
183
Member Avatar for capson

Hello, can someone please tell me why this simple if ststement dose not run [CODE]>>> VList=[0,0,1,0,1,1,0,0] >>> if VList.count(1) < 5: print('Yes') else: print('No')[/CODE] The VList.count(1)works so not sure what is wrong, but I think that's were the code is crashing. Thanks

Member Avatar for capson
0
96
Member Avatar for Simes

Guessing Game with functions, classes, methods, etc [CODE=python]#Code should always be in a method or class #Always start variable names with lowercase, classes could be capital #input.upper() allows the user to use lower or upper case for each option import random from operator import itemgetter def isint(x): try: int(x) return …

Member Avatar for TrustyTony
0
282
Member Avatar for rehber344

hello everyone ı just bougth a new walkman. ı am thınkıng of addıng or writing some media players ın to sony walkman. but ın sıde the walkman ıt has no any applıcatıon or programs do u have any ıdea how to add python programs ınt o walkman and also our …

0
62
Member Avatar for hondros

Okay, so I'm sitting here bashing my head against the desk. I've been googling this for what seems the past hour. I cannot find any relative good links for making Python work with WAMP server. Yes, I understand how CGI scripts work. Unfortunately, I have no idea how to configure …

Member Avatar for satishvis
0
576
Member Avatar for mahesham

Whenever I run my python code, the window do not have any icon.. How to change it some icon or the icon I want to assign? I can assign a good icon for the exe generated thru py2exe. I want to assign icon for the window opened after double clicking …

Member Avatar for mahesham
0
196
Member Avatar for lewashby

[CODE]app = Tk() # creat a tkinter application window called "app" app.title("TVN Game Show") app.geometry("300x100+200+100") b1 = Button(app, text = "Correct!", width = 10, command = play_correct_sound) b1.pack(side = "left", padx = 10, pady = 10)[/CODE] In the above code, I understand that "app" is my TK() object. But what …

Member Avatar for TrustyTony
0
73
Member Avatar for TrustyTony

As I told before here is second implementation of one word anagrams, which prepares lookup table for all available words, if it is not generated and afterwards uses it for fast lookup. The implementation of lookup table generation is quite unoptimized, but it is only done once per vocabulary. If …

Member Avatar for TrustyTony
0
810
Member Avatar for shaqywacky7

I made a program to search something on google and return how many results it has and it works perfectly as long as the sending code is not inside a function. If I put it in a function the reply from google isn't seen as a http packet(even though it …

0
49
Member Avatar for mack00234

I have my image converter up and running, except that I need to have multiple extensions for a single format(JPEG and TIFF). I tried putting the names in separated by commas, but that doesn't work.

0
58
Member Avatar for mack00234

I have been trying to use a wxPython textctrl to display a list of files, but it did not fit my purposes. The wx.StaticText seemed useful, and a ll works except for one major kink; I don't know how to scroll it. Moved post to its own thread, since the …

Member Avatar for mack00234
0
876
Member Avatar for lllllIllIlllI

Hi I was wondering if there was any way in which using Python i would be able to move the mouse pointer and make it click at certain x and y values. This would be used in a Macro type machine for the mouse. I have looked around for modules …

Member Avatar for TrustyTony
0
2K
Member Avatar for frogy

Hi, I was wondering if anyone has a sample code on how to implement fuzzy c means clustering in python for 3D points. I looked around online and haven't found anything promising. Thanks.

Member Avatar for TrustyTony
0
55
Member Avatar for frankinaround

hi. wondering if someone can take a few min to help me out. Well im taking this opencourseware from MIT, intro to programing. I got this assignment [url]http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset9.pdf[/url] and I could do it on my own... the only problem is I dont understand what the hell they want me to …

Member Avatar for TrustyTony
0
264
Member Avatar for muthulazmi

import MySQLdb db = MySQLdb.connect(host = "localhost",user = "root",passwd = " ",db = "TESTDB" ) cursor = db.cursor() sql = """CREATE TABLE CRAWLER ( FIRST_NAME CHAR(20) NOT NULL, LAST_NAME CHAR(20), AGE INT, SEX CHAR(1), INCOME FLOAT )""" cursor.execute(sql) db.close() when i execute this code there is an error occure like …

Member Avatar for muthulazmi
0
91
Member Avatar for muthulazmi

how to install the msqldb package and where to place it in python? then when i compile the code there is an error like no module named MySQLdb.... pls clarify this....

Member Avatar for muthulazmi
0
106
Member Avatar for Hawkpath

Hello All! I ran across a bit of code that I wanted to try. In this code it had a line reading, "[COLOR="Red"]orig = POINT()[/COLOR]" When I tried to run I got this error: [COLOR="red"]NameError: name 'POINT' is not defined[/COLOR]. This led me to believe that I didn't have the …

Member Avatar for Beat_Slayer
0
126
Member Avatar for daviddoria

Hi all, I have started a wiki that I hope to make the "unofficial Daniweb wiki". Its mission is to present short, compilable answers to many commonly asked questions here on the forum. [url]http://programmingexamples.net[/url] I have seeded it with a handful of c++ examples, but I'm hoping that some of …

1
45
Member Avatar for personx1212

hi , i have been searching for a way to modify .exe files using python, to make changes to the exe (inject user code), i found examples using other languages, but how can i do this using python? i know it is possible to alter the exe file because i …

Member Avatar for personx1212
0
93
Member Avatar for wiluo

Hello, I am trying to write a program in python to test the reading speed to a file, apparently,after the file is created, it's automatically in the cache and read() method will grab the data from the cache thus result in a much faster reading speed, how should i directly …

Member Avatar for jcao219
0
4K
Member Avatar for mehdi0016

hi i need some help about zope. i worked with django before but now i want to start a medium project(dynamic website/webapplication) with some developing in future. now i'm not sure to switch to zope. i know zope support mvc like django, but django has some really magics. does zope …

Member Avatar for Tech B
0
75
Member Avatar for sravan953

Hey all, I'm working on a program where I calculate powers of two upto 60. I've made my own formula for calculating it which is: 10^([value of log 2 here]*y), where 'y' is any power as big as, say, 31. So here it is: [code=python] two=0.301029995664 final=math.pow(10,(two*n))-1 [/code] Now... as …

Member Avatar for TrustyTony
0
198
Member Avatar for Tommymac501

I cannot seem to get Reportlab's 4 state bar code to work. I keep getting "NameError: name 'USPS_4State' is not defined", yet if I 'dir' the module it's clearly loaded; dir(usps4s) arcode', 'USPS_4State', '__all__', '__builtins__', '__doc__', '__file__', '__ e__', '__package__', '__version__', '_crc11', '_initNof13Table', '_ru13', '_t The usage is correct as …

Member Avatar for Tommymac501
0
111
Member Avatar for baki100

Can this be done in python and which module would i have to look at. I haven't experimented with this and if I have to guess would it be the os.renames() function.

Member Avatar for baki100
0
92
Member Avatar for tiddster

Is there anyway, without using threading, to get python to do the following do for 5 seconds do action else do something else

Member Avatar for TrustyTony
0
63
Member Avatar for mahesham

Hi, My code opens Excel 97-2003 version Excel file correctly, but gives error when the Excel file is in 2007 (*.xlsx) format. How to solve this? - Mahesh

Member Avatar for mahesham
0
94
Member Avatar for echellwig

Hi I was wondering if there is any way to created a series of lists in a for-loop so that the first list created is named NAME0 or name_0 or indexed in some way. What I have right now is [CODE]for j in range(int(L)): popsizelocus_j=[][/CODE] however, this is not working …

Member Avatar for TrustyTony
0
48K
Member Avatar for Robertbra

Hey Guys : Here The problem is :to have a program to check the -(sys.argv) is long enough to have more than 3 elements if not then print "input more " -check (sys.argv) contain a specific elements for ex(P) ,& if P is found in the given elements then it …

Member Avatar for griswolf
0
117
Member Avatar for ITgirl2010

[code=php] class Item(object): def __init__(self, ID, name, price, stock ): self.ID = ID self.name = name self.price = price self.stock = stock def getID(self): return self.ID def getName(self): return self.name def getPrice(self): return self._price def setPrice(self,value): self.price = value def buyStock(self, howMany): self.stock += howMany def sellStock(self, howMany): if howMany …

Member Avatar for TrustyTony
0
121
Member Avatar for echellwig

Hi, I am trying to write elements from a list that I have created to an outfile using a for-loop with this code: [CODE]for j in range(int(Allele[i])): outfile.write(' allelelocus[j] * ')[/CODE] However when I do this I just get a whole bunch of allelelocus[j] in my out file. I was …

Member Avatar for echellwig
0
155
Member Avatar for aframe

I have a Python script that creates a Tkinter window running in Ubuntu. In the script I have an if/else statement that changes the background color based on a variable. That all works. What I cannot figure out how to do is when it changes the background color, I also …

Member Avatar for woooee
0
2K
Member Avatar for mastermoo420

I put the code on a pastebin thingy so this post would be easier to read. [url]http://paste.pocoo.org/show/229111/[/url] Anyways, basically, I have this 250MB text file that has a string of letters. 50 letters per line, and LOTS and LOTS of lines. I tried doing this before, but I got a …

Member Avatar for mastermoo420
0
110
Member Avatar for gangster88

Can someone help me with this code.. I get an error when I try to execute it [code] from graphics import * def main(): colour = raw_input("Enter the colour: ") win = GraphWin("Patch", 200, 200) drawCircle(win, 50, 50, colour) def drawCircle(win, x, y, colour): for i in range(5): for j …

Member Avatar for vegaseat
0
203
Member Avatar for tiddster

Does anyone know how to download the index page from the website using a python script? For a start, I don't understand the concept, google doesnt seem to throw up any relevant articles so am a little lost!

Member Avatar for Tech B
0
152
Member Avatar for echellwig

Hi, I am having some trouble using the int function on an element of a list. My code currently looks like this. [CODE]for j in range(int(L)): for k in range(int(Allele[j])): alleleslocus_j.insert(k,loci.readline())[/CODE] where Allele is a list of length L inputted by the user. I am having problems with the second …

Member Avatar for echellwig
0
182
Member Avatar for SoulMazer

Okay, I'm not sure what's going on, but tkSnack [URL="http://www.speech.kth.se/snack/"](link)[/URL] is deciding to not work for me all of a sudden. I have written a full-blown freaking media player with it, and I am now failing to simply play a song from the command line. I can get it to …

Member Avatar for SpeedyWizard
0
99
Member Avatar for ryan461

I've got a couple of pdf's on python, but im having trouble grasping how to build classes. Was trying to do it for a poker program and i think im in over my head with that idea. (its a bit big just doing it with functions). So id like an …

Member Avatar for ryan461
0
127
Member Avatar for Simes

[CODE=python]#Code should always be in a method or class #Always start variable names with lowercase, classes could be capital #input.upper() allows the user to use lower or upper case for each option import random from operator import itemgetter def isint(x): try: int(x) return True except: return False print "Invalid guess. …

Member Avatar for Simes
0
109
Member Avatar for tiddster

I have a list containing strings. I want to make a directory for each item in the list, with the name of the directory being the string. Does anyone know if this can be done, and it so, how?

Member Avatar for raj_developer
0
218
Member Avatar for appunu

Hello people, I am writing my own python code which calls a batch file to execute a download files from the ftp, the file size varies regularly.. is there any way to pause the execution of the code until the download completes. ?? i am struck in this part of …

Member Avatar for TrustyTony
0
98
Member Avatar for sandorlev

Hello, guys! I've written a GUI for a program. It's written like shit, the goal was to get it done fast. Well it didn't exactly work out, so when I refresh the data, every label disappears. Here is the code: [CODE] class GUI: def __init__(self, master): self.master = master self.label …

Member Avatar for TrustyTony
0
10K

The End.