15,406 Topics
![]() | |
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] … | |
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 … | |
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 … | |
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. | |
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, … | |
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 … | |
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", … | |
My goal is to call a very simple C++ program from python, see below. The program generates a couple of random numbers and then moves the mouse and clicks. I would like to be able to call it from python with a few inputs(the python side I understand), but i … | |
i'm quite new to programming. i'm a mechanical engineering grad student and i've been learning c++ for a year now on my own. so far i can program only win32 console programs i'll soon finish literature on OOP c++ like Robert Lafores interactive c++, C++ How To Program (Deitel) and … | |
[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 … | |
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 | |
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 … | |
I am a novice. I want to replace a content with a variable How do I do that ? Thanks | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
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. … | |
![]() | Hello, I worked with Python for about a year. Then I moved on to C/C++. Now I'm learning Java. I know the basics of programming really well, and I'm starting to get a good grasp of OOP. I'm learning the syntax of abstract classes and inheritance in Java. I thought … |
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 … | |
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 … | |
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 … | |
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 … | |
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] … | |
Hey guys, I don't understand the for loop. Could someone explain it to me? for example [code] >>> # Measure some strings: ... a = ['cat', 'window', 'defenestrate'] >>> for x in a: ... print x, len(x) ... cat 3 window 6 defenestrate 12 [/code] what is x? how does … | |
I read the message from the queen of the daniweb about surrounding the code with code tags, but I did not understand the message at all. I will enclose this code, and resend it, if necessary if some would explain the "[code]" "[/code]" tag dodad. Basically i have a record … | |
Im very new to SQL in general, let alone coding it into python. I can interact with a MySQL database just fine for the most part, but im running into some problems here... This is the function in my script that keeps raising errors: [CODE=python] def NewChar(): """ NewChar() - … | |
Afternoon all, I currently have some excellent opportunities for talented Python Developers in Oxford, UK. I have both contract and permanent positions available on this exciting new project. The contracts are for 4 months with extension possibilities. Both roles are seeking people who can start ASAP!! If you are interested … | |
Anyone know how I can make a custom titlebar such as the one in windows media player 11 in wxpython? thanks, xtr.eme | |
Hi, my first post here! I have been using python and wxpython for a short time, and have written a few programs, but they all look the same with the standard grey form background... How could I make a really nice interface in python, like the one on Windows Media … | |
For some reason I cannot get my CGI Script to work with my Dreamweaver file. I feel like it may have something to do with where I'm saying things are located. For example, the company website that I am working on has its files located on another website. I assume … | |
Hey guys, new poster so if I am in the wrong spot please just let me know. The below code should read the weather off Yahoo, and create a dictionary containing a bunch of variables and their values from the weather (temp = 9 or whatever), it doesn't. How is … | |
Ok, So i'm attempting to simulate diffusion through a 2-D plate of multiple concentrations of compounds and my program so far looks something like follows [code=python] from scipy import * from pylab import * #============================================================================== #simulation conditions #============================================================================== nx = 64 # The number of x nodes ny = 64 … | |
I am a little new to extending python with C. I have been successful at creating modules that take integers, etc and return a value but I am a little confused about passing a numpy array to a C function. I am using swig to generate the wrappers, and handle … | |
hi evrybody, what is my broblem in this code ? [code] #!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import time import os,sys class Example: def __init__(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect('destroy', lambda w: gtk.main_quit()) vbox=gtk.VBox(True,0) window.add(vbox) vbox.show() label= gtk.Label() vbox.pack_start(label,True,True,0) label.show() for i in xrange(5) : window.move(200+i,600) time.sleep(.1) label.set_label(str(i)) label.show() pass … | |
Hi guys, I need help. I'm a real beginner in Python and ANTLR as well.:P I want to parse an AST object to String, so I may want the result of print like this: [B]sim.access.*[/B] instead of: [B] ( . ( . sim access ) * )[/B] Thanks and regards, … | |
I am getting very strange results from the following: def list(self) import shelve db = shelve.open(testfile) list = [] cnt = 0 for id in db.keys(): print db[id].info() the testfile was written with an class defined object; What i am finding, is if I write 50 objects, the above code … | |
I have been a hardware engineer forever (25+), and was introduced to python to build configurable verilog in sonicsinc in san jose. I really like the language, and have taken the time to read a couple of books, as well as writing lots of hardware style python code ( not … | |
Hey, I decided I'm going to try to make a small game, now I need help though since ussally I use Ruby and Python not C++. The help I need is in find an server / client libary (sorry for my sentences beeing so choppy dunno why today) If someone … | |
I am working on an IDE for a specific language. One of the features that I want to implement is syntax high-lighting. The way I plan to go about it: When the user presses a key, a function is called with the entire line that the user is editing as … | |
Hello, I'm trying to use [URL=http://mediainfo.sourceforge.net/]MediaInfo[/URL] library in python via ctypes. I tried this code: [CODE]import ctypes milib = ctypes.cdll.LoadLibrary("mediainfo.dll") handle = milib.MediaInfo_New() milib.MediaInfo_Open(handle, "D:\temp\video.avi") [/CODE] Unfortunately the last line complaints that there are not enough parameters for that function. I based this on a sample Delphi code, which is … | |
Just using this to introduce myself to the forum. The name is Douglas, but I go by the handle azadder. I program and design. I am located just outside of Baton Rouge, Louisiana (Gonzales, LA). Joined up because I was looking for some python help, and I saw all the … | |
I'm trying to change the font for the turtle graph. [code] def goto(x,y): turtle.up() turtle.goto(x,y) turtle.down import turtle turtle.tracer(False) turtle.width(3) goto(-270,270) turtle.right(90) turtle.forward(540) turtle.left(90) turtle.forward(540) turtle.left(90) turtle.forward(540) turtle.left(90) turtle.forward(540) goto(50,50)[B] turtle.write('testing')[/B] turtle.tracer(True) [/code] That's a box I created and I want to add text to it. I looked around the … | |
Can anyone point me in the direction of a small app that displays 2 panels on a frame, where one panel is small and at the top taking up about 20% of the frame, and the other panel takes up 80%. I would like it to be possible using wxBoxSizer … | |
Program terminated with signal 11, Segmentation fault. Environment: FreeBSD 6.2, Python 2.4.4, MySQLdb 1.2.2, SQLObject 0.9.1 I faced with an error in our multithreaded, network oriented application, wich interacts actively with MySQL database. Brief information from core dump is below (more detailed one is in the file attached). Though I … | |
I have this url (ISO-8859-1 encoded): file://///companyweb/pr%C3%B8ve.doc which I need transformed into this url (UTF-8 encoded): file://///companyweb/pr%F8ve.doc The difference is the character 'ΓΈ' which will be encoded as '%C3%B8' in the first case, and as '%F8' in the latter. In Java I would be able to do this conversion very … |
The End.