14,946 Topics

Member Avatar for
Member Avatar for nightwalker

Hello everybody, my name is Ludvig, I am a swedish student who educates myself to become an engineer. For my programming course I have made a minesweepergame, but to get the highest grade availible, I have to make it in graphics. I have succeded in doing a version without the …

Member Avatar for vegaseat
0
105
Member Avatar for voodoo_doctor

Hey there! Right now I'm working on a system that is built according to MVC-model. All three levels have try/catch statements for things where errors might occur. The problem is that I want all those messages to show up in GUI (View). Right now I'm having some troubles doing it …

Member Avatar for voodoo_doctor
0
66
Member Avatar for Mr.popo

Ive got my own python modules which I need to place somewhere so python can read them. Ive got two questions. 1. Wheres the best place to put modules? 2. It wont let me add modules to /usr/lib/python2.5? Thanks Mr.popo

Member Avatar for Mr.popo
0
1K
Member Avatar for laspal

Hi I wanted to know how can I make sure that table exist in my database. [code] class Record: def __init__(self): self.conn = MySQLdb.connect( host = 'localhost', user = 'root', passwd = 'abcd', db = 'justfun') self.cursor = self.conn.cursor() self.cursor.execute("DROP TABLE IF EXISTS book") self.cursor.execute( """CREATE TABLE book (name char(40), …

Member Avatar for katharnakh
0
3K
Member Avatar for axn

here is the snippet data = ''2007-12-31 Name (mike) Age (34).....' gregorian = time.strftime(data.split(" ")[0]) print gregorian this gives me "2007-12-31" i need to convert the gregorian date in the variable to julian date. i tried this but it gives me the current date julian = time.strftime('%j', time.localtime())

Member Avatar for Duoas
0
2K
Member Avatar for boni_go

Hello, I have some problem with os exception. In the traceback info I get only the errno without the description. for examplem when I write: [code=python] import os; os.listdir("no-exists-dir-name"); [/code] I get the exception: [code=python] Traceback (most recent call last): File "<interactive input>", line 1, in <module> WindowsError: [Error 3] …

Member Avatar for SteveWhite
0
435
Member Avatar for knish

Hi, I have two py programs. both have while 1: loops. Lets say File A has one while 1: loop and File B has another while 1: loop. File A has a break statement. File B has no break statement. File B is running. I now run File A. This …

Member Avatar for Duoas
0
98
Member Avatar for laspal

Hi I wanted to know how can I delete class object inside list. class Record: def __init__(self): self.list = [] def add(self): fname = raw_input("First Name:> ") lname = raw_input("Last Name:> ") street = raw_input("Street:> ") self.list.append( Person( fname, lname, street)) Now I have added my Person object into the …

Member Avatar for katharnakh
0
4K
Member Avatar for gaowei

I want to learn python in my holiday!But I don't know which python's book is well.Who can recommend one good book to me! how to learn python! What is important part of python? I'd like to have your advice as to me. Thanks in advance. Any help is much appreciated.

Member Avatar for Impact4ever
0
104
Member Avatar for seamus.boyle

I'm trying trying to use the Image.composite() function with the code below: [code=python] import Image im1 = Image.open("GetGif1.png") im2 = Image.open("GetGif2.png") im3 = Image.composite('im1','im2',"L") im.save('output.png') [/code] But I get this error: [code] Traceback (most recent call last): File "composite_images.py", line 11, in <module> im3 = Image.composite('im1','im2',"L") File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1960, …

Member Avatar for seamus.boyle
0
212
Member Avatar for gtselvam

I have a python script that will run a batch script. This batch script sets an environment variable say _BLDPATH. I want to grab this variable in the python script to use that variable later on. The problem is that even though the variable gets set properly when the batch …

Member Avatar for Duoas
0
213
Member Avatar for StrikerX11

Hi, I've been trying to code a simple file sharing system in python by using Discovery server -indexer- model Server: [CODE]#!bin/python import socket import sys import os import threading from utils import serialize, deserialize, PeerInfo class NotSupportedCommand(Exception): pass class DiscoveryServer(object): '''Indexer...''' def __init__(self, port, maxPeers=5): self.port=port addr=('', self.port) self.maxPeers=maxPeers self.supportedCommands=["/register", …

Member Avatar for StrikerX11
0
120
Member Avatar for morrison

[QUOTE=Ancient Dragon;267023]You cannot write directly to an *.xls file and expect Excel to read it because *.xls files are not plain text files -- they contain a lot of formatting information that is readable only by Excel program. The easiest way to do it is to creates *.csv files which …

Member Avatar for sneekula
0
138
Member Avatar for GRaymer

Just wondering if anyone has experience with wxPython. I've been looking for info about the spinButton I want to increment it at 5's or 10's just wondering if anyone has some quit hints or info. Thanks

Member Avatar for vegaseat
0
80
Member Avatar for sneekula

I want to make a small Molecular Weight calculator. If the user for instance enters the molecular formula for dichloro-benzoic acid as "C6H3Cl2COOH", I would like to split it into a list like ['C6', 'H3', 'Cl2', 'C', 'O', 'O', 'H'] so I can then combine all the carbons, chlorines, oxygens …

Member Avatar for sneekula
0
114
Member Avatar for maslak
Member Avatar for sneekula
0
128
Member Avatar for laspal

Hi I am new to python. So i am having problem while coding. Here the code import sys class Person: def __init__(self): self.list = [] def AddContact(self): fname = raw_input("First Name:> ") lname = raw_input("Last Name:> ") street = raw_input("Street:> ") self.list = [ fname, lname, street] def ListAll(self): print …

Member Avatar for sneekula
0
99
Member Avatar for laseredd

I have created a small program in Python that asks you if you have done something, and then logs the date, question(s) and answer(s) to a file. I thought of writing a program like this while walking to the toilet and twenty minutes later I had finished the program. I …

Member Avatar for laseredd
0
128
Member Avatar for magneto

OK, I am very new in programming, and I installed python2.5.1 and pygame, and I wrote the hello world programme etc. and I ran it in the python shell. But the problem is, I can't run any python document outside the shell. I tried an example in pygame, and the …

Member Avatar for laseredd
0
102
Member Avatar for mccarthp

Hello, I am very new to Python and have, what I think, is a rather simple question. First, I am running Python 2.1 on Win XP. What I want to do is open a CF page after my process has run and pass the processID, that I will set, and …

Member Avatar for jrcagle
0
470
Member Avatar for xav.vijay

Hi I am trying to view the security certificate of a secured web page. ex: [url]https://somesite.com[/url] I need to do this via a python script to collect some data from the certificate, like the CN, OU, Street etc values. It can be done with win32com, but not sure about the …

Member Avatar for xav.vijay
0
94
Member Avatar for jem00

hey again, I wrote this code.. very quickly and messily. I would like to 'clean' it up.. that is put some functions in it. [CODE]def numWords(aString): lst = aString.split() noword = 0 for word in lst: noword = noword + 1 return noword def save inp = raw_input("Please enter some …

Member Avatar for jrcagle
0
77
Member Avatar for skibum_not

I'm developing a cgi-bin application that must be unicode sensitive. I'm striving for a UTF8 implementation. I'm running python 2.3 on a development machine (windows xp) and a server (windows xp server). Both environments are running Apache 2.2 with the same configuration file. The problem is this. On my development …

Member Avatar for Ene Uran
0
426
Member Avatar for jem00

Hey guys, I just wanted to know if anyone recommends an IDE because I am using IDLE and its not really shining.. to me. Thanks.

Member Avatar for Ene Uran
0
74
Member Avatar for skibum_not

Dear web gods: After much, much, much struggle with unicode, many an hour reading all the examples online, coding them, testing them, ripping them apart and putting them back together, I am humbled. Therefore, I humble myself before you to seek guidance on a simple python unicode cgi-bin scripting problem. …

Member Avatar for skibum_not
0
136
Member Avatar for jem00

Hey guys, I'm following a tutorial on Python and I came across this in one of the examples. [CODE]import time today = time.localtime(time.time()) theDate = time.strftime("%A %B %d", today) print today print theDate [/CODE] Result:[CODE](2007, 12, 20, 9, 48, 15, 3, 354, 1) Thursday December 20[/CODE] can someone explain to …

Member Avatar for jrcagle
0
177
Member Avatar for Roadphantom13

Ok. Newbie poster/programmer so bear with me. I created a beginner math program that should be usable by young children. I have it working for the most part but now there are three things I would like to do to make the program more professional. First, I would now like …

Member Avatar for jrcagle
0
105
Member Avatar for neverlander

I wrote a while loop in pyqt but I want it to stop to take input from user.I do this in python with raw_input but it doesn't work in pyqt.How can I do this in pyqt. [CODE] while cev != cevap: tahminler += 1 ui.label_6.setText(QtGui.QApplication.translate("MainWindow", "Yanlış cevap!", None, QtGui.QApplication.UnicodeUTF8)) f …

Member Avatar for jrcagle
0
110
Member Avatar for Bezukhof

I'm having a good deal of trouble figuring out how to sum the values of a list until they reach a specified goal. This is a H.W. assignment and it is as follows: "Define a Python function threshold(dailyGains, goal) that behaves as follows. The first parameter is a list of …

Member Avatar for woooee
0
129
Member Avatar for jem00

is it possible to create a looping list? [code]import time # a day value of None = > def dayOfWeek(DayNum = None): # match day order to Python return values days = ['Monday','Tuesday', 'Wednesday','Thursday', 'Friday','Saturday','Sunday'] theTime = time.localtime(time.time()) # Check for default value if DayNum == None: Day = theTime[6] …

Member Avatar for jem00
0
75

The End.