15,190 Topics

Member Avatar for
Member Avatar for HiHe

The small code shown below works fine with Python26, however Python31 gives an error: fout.write('.snd' + pack('>5L', 24, 8*dur, 2, 8000, 1)) TypeError: Can't convert 'bytes' object to str implicitly Does anyone know what I need to do to make it work with Python31? [code]# create a soundfile in AU …

0
76
Member Avatar for Lapixx

Hi, I'm trying to create a textgame in python, and after searching for a few topics about it I though I knew how to make it. Many textgames use a system like this: [CODE]def room_one(): #do stuff if something: room_two() def room_two(): #do stuff [/CODE] Most of the time the …

Member Avatar for ultimatebuster
0
167
Member Avatar for TrustyTony

Here is my newest baby, the pretty.py module, born today, which I start to use instead of pprint module. Reason to make this (in addition to that it is possible to do) is that I had this problem, sorry long, LONG example: UPDATE: take out the [CODE]or j[/CODE] that was …

Member Avatar for TrustyTony
0
2K
Member Avatar for alabandit

I generate an array from the folders in a directory; which is placed in an array. i then compare it for changes in the currant folder.This way i can monitor for new files that are add to the system and trigger the script. but i am having problems comparing the …

Member Avatar for alabandit
0
123
Member Avatar for nsutton

I know the code for sending mail is. [CODE] import smtplib fromaddr = 'fromuser@gmail.com' toaddrs = 'touser@gmail.com' msg = 'There was a terrible error that occured and I wanted you to know!' # The actual mail send server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(username,password) server.sendmail(fromaddr, toaddrs, msg) server.quit() [/CODE] Basically its a …

Member Avatar for nsutton
0
111
Member Avatar for Aeronobe

I'm having this problem with passing a variable. Basically i'm trying to find every url in a HTML document. I'm doing this using the HTMLParser class (i made an extension of it). This is the code: [ICODE]class Parser(HTMLParser.HTMLParser): def __init__(self, url): HTMLParser.HTMLParser.__init__(self) req = urllib2.urlopen(url) self.feed(req.read()) def handle_starttag(self, tag,attrs): if …

Member Avatar for Aeronobe
0
95
Member Avatar for Qwazil

Hey all, I'm a beginner. When i feed a list of lines into this for statement, i have trouble getting the output into a set for use outside of the for statement. [CODE] ListofWordsinLines = {} words = [] for line in ListOfLines: words = line.split() ListofWordsinLines = set(words)[/CODE] if …

Member Avatar for TrustyTony
0
156
Member Avatar for jpl1993

class tennis: def __init__ (self, name, rank, tournamentsPlayed, country, racquetBrand): self.name = name self.rank = rank self.tournamentsPlayed = tournamentsPlayed self.country = country self.racquetBrand = racquetBrand #defines each thing^ def __str__(self):#creates a string return self.name + ":" + self.rank + "\n" + self.tournamentsPlayed + "\n" + self.country + "\n" + self.racquetBrand …

Member Avatar for TrustyTony
0
137
Member Avatar for Hawkeye Python

I'm trying to create a python cards game (a Brazilian cards game). But when I try to print some values (the cards played) it returns the following error: [QUOTE]Traceback (most recent call last): File "<pyshell#16>", line 1, in <module> play() File "C:\Documents and Settings\Terminal\Desktop\Truco.py", line 71, in play print "You …

Member Avatar for Hawkeye Python
0
231
Member Avatar for SgtMe

Hi. I am trying to get texturing to work in PyOpenGL in 2D. I have the following code so far for textures: [CODE]def tex(path): img = pygame.image.load(path) img.convert_alpha() try: ix, iy, image = img.get_width(), img.get_height(), pygame.image.tostring(img, 'RGBA') except SystemError: ix, iy, image = imgs.get_width(), img.get_height(), pygame.image.tostring(img, 'RGBA') ID = glGenTextures(1) …

0
83
Member Avatar for azrael_

Hi there. I am currently writing a registration program in Python, and have come across a problem. In my hours of searching, there seems to be no way to split a list that has elements obtained from [B]raw_input[/B]. Basically, I would like to take input from a user, feed it …

Member Avatar for TrustyTony
0
215
Member Avatar for chebude

I was able to print out daily values and aggregate the final annual result but I am lost and dont know where to start on how to sum the daily values to monthly and print it out. I need your help badely. Here is part of the code [CODE] import …

Member Avatar for woooee
0
146
Member Avatar for capri19

hi all I'm trying to make a simple web using a form and method="POST" My page works fine in Firefox but fails in IE6. Can anyone tell me what I'm doing wrong ? Here is my code [code] import cgi import os import parseFieldStorage import time def test(): print 'Content-Type: …

Member Avatar for tamarteleco
0
188
Member Avatar for jpl1993

so i'm almost done with my project. however, i'm still getting some errors when i run. you can find my code below. if you see any problems and know how to fix them, please, please, please let me know! class tennis: def __init__ (self, name, rank, tournamentsPlayed, country, racquetBrand): self.name …

Member Avatar for woooee
0
146
Member Avatar for jib

[B][INDENT]below is the tutorials for developing the program i had a hard time with it. Part 1: Blackjack Card Game Blackjack is a card game played in casinos. The game is also called Twenty-One. Blackjack came originally from France, where it is called Vingt-Et-Un (21). The goal for both the …

Member Avatar for woooee
0
365
Member Avatar for stabzagg

Hey guys, I am having some trouble getting my head around tkinter at the moment. I am new to programming and have been using python for about 2 months now. The problem I am having is with RadioButtons. I have a set of radio buttons numbered 1-9 and I can …

Member Avatar for stabzagg
0
304
Member Avatar for dbphydb

Hi, I want to search for a particular text on an html page ---> Build Complete Further execution should be only if the build is successful which is denoted by the text 'Build Complete' on the webpage. Denoted in bold in the code below. [CODE] URL = "http://11.12.13.27:8080/cruisecontrol" from urllib2 …

0
65
Member Avatar for dbphydb

Hi, Please check the below code. [CODE] URL = "http://11.12.13.27:8080/cruisecontrol" from urllib2 import urlopen from HTMLParser import HTMLParser import re # Fetching links using HTMLParser def get_links(url): parser = MyHTMLParser() parser.feed(urlopen(url).read()) parser.close() return parser.links # Build url for Deploy page def get_deploy_url(): url = URL + "/buildresults/xxx_%s_nightly_build" % branch print …

Member Avatar for dbphydb
0
112
Member Avatar for dreadyteddy

Basically need help with one evil section of code! My program opens a start window which introduces the program. A start button leads to a second window with a number of buttons. The main two are "open" and "find restriction site". Im having problem with the code for the latter. …

Member Avatar for dreadyteddy
0
230
Member Avatar for Steven.T

Hi, I need to create a spell checking program where: - the dictionary is loaded in as a set() - the 2nd file is input by the user - all words that are not in the dictionary are added to a list and printed out My code so far is: …

Member Avatar for TrustyTony
0
184
Member Avatar for jl487

Hello, I currently have the following python code: [CODE] #usr/bin/python import os variable=raw_input('Search for this string: ') os.system("grep $variable sample.txt") [/CODE] Basically what I want to do is to grep a string found in the text file "sample.txt" When I run the code, it just hangs. How can I make …

Member Avatar for TrustyTony
0
11K
Member Avatar for dbphydb

Hi, Im basically from QA. I have a piece of code in python that parses HTML pages to reach to a specific link on a webpage. The below code gets me the url of the link which needs to be clicked. What code should i write to simulate clicking a …

Member Avatar for TrustyTony
0
978
Member Avatar for dbphydb

Hi, The below code is doing the following 1. Reading the branch name and the destination from a txt file 2. Parsing thru HTML pages Basically, i want to deploy the build of the branch (supplied thru txt file) on a test environment (supplied thru txt file) The branch_dest file …

Member Avatar for dbphydb
0
205
Member Avatar for gunbuster363
Member Avatar for Lapixx

Hi, I'm new to Python, and although I've quite some programming experience, I wasn't able to find an answer for this problem: As a first project, I am trying to create a small text game. All is going well (since it's very basic), except for my inventory system. At the …

Member Avatar for snippsat
0
8K
Member Avatar for xheavenlyx

Hello everyone, I have searched for this high and low but could not find a solution. To elaborate on the heading. I am trying to figure out a way to do this: 1. I have a text file with one line paths and file listing in it, for example: [CODE] …

Member Avatar for xheavenlyx
0
115
Member Avatar for gabyallheart

I have this program, is working good but i got error when the rows are full because stop and not keep going...can some one help me please..:) import random class Rack(object): def __init__(self, cols, rows): self.rows = rows self.cols = cols grid = Rack(7,6) def returnStartRack(xLen,yLen, blank): grid = [] …

Member Avatar for TrustyTony
0
87
Member Avatar for voolvif

Hi, I'm trying to count the number of unique IP addresses present in an apache log file. I am using a text file to store the unique IP addresses as this needs to scale to large numbers of IP addresses (upwards of 100 million) so using a dictionary or any …

Member Avatar for TrustyTony
0
2K
Member Avatar for Kruptein

Okay my syntax highlighter works very well, I only have on problem, Sometimes GetWords() adds "\n" to operatorless although there isn't pressed an enter I think the problem is within the GetWords() function, but I give all functions to be sure.. Main function is OnKeyUp, colorize prints the text colored …

Member Avatar for Kruptein
0
110
Member Avatar for pythonNerd159

Hey all, I'm currently making a button so that when i click on it, it shows the number of that button in an [B]Entry Screen[/B]. If you can help me it would be great. Thanks again! :) [CODE]def createSeven(self): top=self.winfo_toplevel() top.rowconfigure(0, weight=1) top.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.Button = …

Member Avatar for Ene Uran
0
85

The End.