15,194 Topics

Member Avatar for
Member Avatar for wotthe2000

Hi I have certain number of books which each have an author, title and ISBN number. How is the best way I can store this so that when I want a list of the books I will be able to list the books with the title, author and ISBN number? …

Member Avatar for Ghostenshell
0
153
Member Avatar for adam291086

In php you can use $_GET['adam'] to get the information from adam in the url Can you do the same in python? if so how?

0
76
Member Avatar for thehivetyrant

[B]Hi i've been assigned with doing a torn square, and i've kinda got it working with the code below.[/B] [code] import turtle turtle.reset() length=100 degree=60 i=0 while i < 4: turtle.forward(length/length*40) turtle.right(degree) turtle.forward(length/2) turtle.left(degree+degree) turtle.forward(length/2) turtle.right(degree) turtle.forward(length/length*40) i+=1 turtle.right(90) else: raw_input("there's hopefully a square, all torn like!") [/code] as you …

Member Avatar for thehivetyrant
0
492
Member Avatar for mrpoate

Hi, I'm currently working on a project in Python 2.6.1 using the Tkinter interface, and being new to both Python and Tkinter I've quickly found a problem that keen internet trawling hasn't seemed to help. I'm sure its not a particularly difficult problem or anything, but instead of spending probably …

Member Avatar for mrpoate
0
135
Member Avatar for OffbeatPatriot

At my lab the professor bought a camera that came with a c library to control it from a computer. Right now he wants me to create a gui in matlab to control it but I'm such a python zealot I'd rather do it in that, and then call it …

Member Avatar for OffbeatPatriot
0
259
Member Avatar for scru

Is there a way to add a directory to the locations that python look at when you call __import__ ? I need to import some scripts from a user folder at runtime, and since __import__ doesn't accept absolute file names, I'd like to try this. Copying the script to the …

Member Avatar for scru
0
143
Member Avatar for revenge2

Hey guys, well here are some more of my questions (sorry!! i know, im a pain..) Ive finished "most" of everything in this [URL="http://www.swaroopch.com/notes/Python_en:Table_of_Contents"]tutorial[/URL]. I missed some out because they were too much for me to understand at the time. will go back to them and come back with more …

Member Avatar for Ene Uran
0
125
Member Avatar for EAnder

I know the codes not the best well written but the only problem I'm having(besides the interpreting of the macro commands, the one here is just a base for me to work on) is how the UpdateLabels.start() method returns: [code]Traceback (most recent call last): File "C:\Users\Erik\Desktop\Stuff from last Night\MouseMacro.py", line …

Member Avatar for Ene Uran
0
118
Member Avatar for revenge2

hello again, Ive got the basics under my belt and ready to start making things happen:D. I want to experiment with different things so could you show me to some good tutorials on some of the following things. 1. sending and receive messages through the internet-what library/Mod should i use? …

Member Avatar for Ene Uran
0
106
Member Avatar for harrykokil

hello guys im stuck for quite a while with this problem and i badly need ur help. in fact i wanna make the red rectangle slow down when it comes close to the blue one. it would be nice if they both move at the same speed. ive tried several …

Member Avatar for harrykokil
0
78
Member Avatar for mrpoate

Hi, This is my first time on daniweb, so if I've posted in the wrong section or there's already a similarly-themed thread or I've done something wrong I apologise. Anyway, I'm hoping someone can prod me in the right direction with a problem I'm having right now. I'm currently working …

Member Avatar for mrpoate
0
2K
Member Avatar for jworld2

Okay, my first question is about wxpython's registerhotkey. As far as I can find, there are not letter key keycodes. This example relies on the win32con module: def regHotKey(self): """ This function registers the hotkey Alt+F1 with id=100 """ self.hotKeyId = 100 self.RegisterHotKey( self.hotKeyId, win32con.MOD_ALT, win32con.VK_F1) -- I want to …

Member Avatar for lllllIllIlllI
0
164
Member Avatar for adam291086

I am trying to write some simple information to a file and i am getting the error message "No such file or directory when i know full well it exists. If you take the url [url]http://www.adamplowman.com/uni_project/log.txt[/url] you get the file heres the code [CODE]#!/usr/bin/python print "Creating a text file with …

Member Avatar for Gribouillis
0
121
Member Avatar for juzzy

hi I wonder if anyone can help? I am trying to write a simple server_side message reciever so i can send messages from one machine to another, I want the program wrapped in a gui and i have been doing this using tkinter. However I have a problem, I can …

0
47
Member Avatar for adam291086

I am trying to construct a class and call upon some functions within that class, but nothing is returned, somehting should definitely be returned [CODE] #!/usr/bin/python import cElementTree as ET import urllib2 import MySQLdb print "Content-type: text/html\n" class xml: @staticmethod def find_text(element): if element.text: yield element for subelement in element: …

Member Avatar for adam291086
0
172
Member Avatar for Clipper34

Hey everyone, well i've been recently for the last day pondering on the idea of creating a web spider, but i just don't know where to start. What i think mainly the spider is built off of using the urllib, socket, and urllib2 modules to do the spiders bidding, i …

Member Avatar for woooee
0
130
Member Avatar for TheNational22

There is a thread in here somewhere that spoke of the issue but it did not describe a fix. I am running Vista home premium 64-bit SP1. When I open a wxPython window, it runs. As soon as my mouse enters the frame, a message comes up stating "python.exe has …

Member Avatar for TheNational22
0
96
Member Avatar for ruba_cti

Hi, I'm getting this error when reading from a csv file: "Runtime Error! line contains NULL byte". Any idea about the root cause of this error? If it helps, here's the part of my code where I'm reading the csv file. [QUOTE]def processFile(): global DATA # - Input file global …

Member Avatar for ruba_cti
0
2K
Member Avatar for harrykokil

can u plz debug it for me?? thanks [icode] import Tkinter as tk import time import sys import datetime as dt from Tkinter import * root=tk.Tk() root.title("Traffic Simulation") canvas = tk.Canvas(root, width=1000, height=400, bg="#FFFFFF") canvas.pack() for x in range (1,10): print 'orange'+x canvas.update() root.mainloop() [/icode]

Member Avatar for harrykokil
0
97
Member Avatar for Aue

make python program count the number of two words on a webpage (for instance, 'keep' and 'delete') and return it.

Member Avatar for leegeorg07
0
84
Member Avatar for bharatvamsi

hi, i'm novice user in python and i want to capture data at a specific port using python script.Please suggest me the approach. Same data i'm able to write into a file using linux command: tethereal -i any "port 9060" -w sam.txt I want to accomplish the above task using …

Member Avatar for lllllIllIlllI
0
58
Member Avatar for Stefano Mtangoo

I use bass.dll to play music files from [url]http://www.un4seen.com/[/url] I try to use function called BASS_ChannelSetPosition. I use ctypes to access the Library. Below is the part of documentation (comes with bass as help file) I need somebody to tell me whether the mode (BASS_POS_BYTE, BASS_MUSIC_POSRESET...etc) is a function or …

Member Avatar for Stefano Mtangoo
0
213
Member Avatar for lllllIllIlllI

Hi In one of my programs i use a wx.ToolBar, and this toolbar is meant to show a range of picutes that help the user with doing things quickly and easily. But the thing with mine is that i am using 64x64 images for the toolbar, yet when i set …

Member Avatar for lllllIllIlllI
0
95
Member Avatar for adam291086

I have this script and it was working a couple of weeks ago. Now when i run it nothing is printed out other than white space. WHY??? [CODE]#!/usr/bin/env python from xml.etree import ElementTree as ET import os import urllib def find_text(element): if element.text is None: for subelement in element: for …

Member Avatar for adam291086
0
105
Member Avatar for revenge2

hello there. I'm using notepad++ at the moment and i want to switch to something a little more 'better' suited to python. Ive already gone through the huge list of text editors on [URL="http://wiki.python.org/moin/PythonEditors"]wiki[/URL]. but yeah cant decide.... what would you recommend?

Member Avatar for Ene Uran
0
91
Member Avatar for tzushky

Hello , I have had a little surprise and maybe because I haven't read the manual well enough or can't understand all the underlying details. Imagine a small class and another file's main using an instance of that class. If I try to modify (not define !) an INEXISTANT attribute …

Member Avatar for Gribouillis
0
226
Member Avatar for SoulMazer

For reference, I am using Python 3.0. So, I have a small script I am working on trying to improve. I am now trying to create it with only dictionaries and loops. My problem is that I keep getting a Key Error at one of my lines. The line with …

Member Avatar for SoulMazer
0
161
Member Avatar for wheatontrue

Hello - my Python 2.5 IDLE used to start up, but now it won't. I tried looking at the preferences - those don't have any glaring mistakes. When I try to start it command line I get the following error: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. …

Member Avatar for wheatontrue
0
320
Member Avatar for Stefano Mtangoo

I have python 2.6 portable and would pop error when I import wx. After some search, I found The prementioned package missing in the XP system. I downloaded and Installed and went fine. My Question is : Is there any way to add vcredist_x86.exe's missing DLL direct to wxpython directory …

Member Avatar for Stefano Mtangoo
0
177
Member Avatar for codedhands

Hello.Please i have a problem with my code.I am trying to edit a file.The problem occurs when i use the seek function.for example,i have a file outlined like this: [CODE] myfile.txt <Name>Ben</Name> <Age>32</Age> <Sex>Male</Sex> <Country>Mars City</Country> [/CODE] Now,when i try to edit the Age,i use the code: [CODE=python] f=open('myfile.txt','a') f.seek(17,0) …

Member Avatar for lllllIllIlllI
0
98
Member Avatar for starzstar

Hi, I am new to Python and have a requirement to develop a simple requirement to design a login screen, and then a screen which will have two parts in it one will show local files and other files on server I am planning to use tkinter for this is …

Member Avatar for jlm699
0
115
Member Avatar for Stonehambey

Hi guys :) Did a bit of searching but couldn't find much on this, so I thought I'd ask here. I want a Tkinter Label to display a polynomial, so naturally I need to put some superscript formatting onto it. But I can't seem to work out how to. Any …

Member Avatar for Ene Uran
0
2K
Member Avatar for leegeorg07

hi again i have been looking at the bacon cipher and i have made this [ICODE]import re dictionaryofcodes = {'A': '11111', 'B': '11110', 'C': '11101', 'D': '11100', 'E': '110111', 'F': '11010', 'G': '11001', 'H': '11000', 'I': '10111', 'J': '10110', 'K': '10101', 'L': '10100', 'M': '10011', 'N': '10010', 'O': '10001', 'P': …

Member Avatar for leegeorg07
0
125
Member Avatar for Gribouillis

What do you think would be the best way to write this structure [code=python] if testA: actionA() if testB: actionB() if textC: actionC() else: actionDefault() else: actionDefault() else: actionDefault() [/code] if I want to write only one call to actionDefault() ?

Member Avatar for Gribouillis
0
139
Member Avatar for Aue
Member Avatar for Apollo64

I am some-what new to programming in python, and i'm trying to make a game but I need to know some of theses thing. Sprites I have sprites created, but how do I import them and print them on the screen? Movement I am completely clueless on how to make …

Member Avatar for jlm699
0
112
Member Avatar for dineshjaju

[CODE]#Python code: import csv # first we need import necessary lib:csv file=open("dinesh.csv") #prepare a csv file for our example testWriter = csv.writer(open('dinesh.csv', 'w'), delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamWriter.writerow(['Test'] * 5 + ['Wow'])[/CODE] [B]Error:-[/B] <type 'exceptions.IOError'>: invalid mode: w args = ('invalid mode: w',) errno = None filename = None message …

Member Avatar for jice
0
104
Member Avatar for i_saw_some

Hi, I am using Django 1.0 and Python 2.5.2 on Ubuntu Hardy Heron. My Python application must load a large amount of data - an object that represents a huge non-hierarchal network. Once this lengthy loading process is completed, calculations can be performed very quickly from then on. In my …

0
21
Member Avatar for jvignacio

hey guys im trying to get my html and python cgi script working together to show the users selections of the checkboxes of bulbs and add them up aswell plus the method they wana pay once they pretty the submit form button.. here is my html code: [CODE]<html> <body> <form …

Member Avatar for jvignacio
0
192
Member Avatar for babanner

This is my code [code=python] import urllib.request, urllib.parse,http.cookiejar url="http://localhost/test.php" cs=http.cookiejar.FileCookieJar("cookies.txt") cs.load("cookies.txt",ignore_discard=False, ignore_expires=False) opener=urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cs)) y=opener.open(url) print(y.read()) [/code] It seems to be correctly according to the Python 3.0 documentation (which is very,very poor). However i get an error: FileCookieJar has not attribue '_self_load'. Please help.

Member Avatar for jlm699
0
85
Member Avatar for mn_kthompson

I was looking over some code for an open source project and I saw some strange whitespace stuff that I didn't even think would run. The thing is, it runs just fine. I was wondering if someone could explain what I'm missing. I don't want to copy the exact code, …

Member Avatar for sneekula
0
135
Member Avatar for tzushky

Hi, Something new from me: I have an application which can act as server and client (launch them on separate PCs). I need the server stdout because it displays some data for evaluating their communication. I start the server through a [B]subprocess.Popen[/B] giving its stdout to [B]PIPE[/B] [CODE=Python] from subprocess …

Member Avatar for Gribouillis
0
14K
Member Avatar for red999

I am creating a script that allows me to calculate the future value of an investment at the end of x years, but I am having a little trouble writing the summation syntax in my script. I am not familar with the sum syntax so I do not know how …

Member Avatar for paddy3118
0
187
Member Avatar for jvignacio

Im trying to figure out a python script where, If there is no user input, it generates a form which asks for the user's name and email address by using the action form. any ideas ? any help much appreciated..thanks guys

Member Avatar for Freaky_Chris
0
68
Member Avatar for Stefano Mtangoo

Hi all, I have been trying to write and retrieve data from SQLite Database. So far I can make connection, cursor; but cannot get table populated(fails to execute SQL statement). Since I read somewhere that it is recommended to use ? instead of % then I tries it but I …

Member Avatar for Stefano Mtangoo
0
2K
Member Avatar for rajeesh_rsn

Hi i am a php programmer. Kindly let me know a good book for begin python from its basic ??? Thanks

Member Avatar for Stefano Mtangoo
0
83
Member Avatar for Ghostenshell

Can anyone simplify this for me? I don't know if it is going to work I tried to adjust the code to fit on the page. Might have to delete the extra [ICODE]+\[/ICODE] [CODE=python]def main(): try: infile = open('text.txt','r') files = infile.readlines() lower,count,blank,dig = 0,0,0,0 #Counting uppercase for line in …

Member Avatar for Stefano Mtangoo
0
972
Member Avatar for Radly

I'm sure this is either easy or impossible. :) I have a Windows command console window open with a Python 2.5 interpreter running. I also have a text editor open on a module I'm debugging. What I'd like to do is make some changes in the editor, save the file, …

Member Avatar for Radly
0
88
Member Avatar for wotthe2000

Hi, i'm having some trouble using the built-in apply function. I want to take a string in an external definition then apply definitions on it which are in a class. The code I have is: [ICODE] global msgstr def create_message(message, msgstr): if msgstr[0:3].upper() == 'CMD': return apply(message, (msgstr)) elif msgstr[0:3].upper() …

Member Avatar for wotthe2000
0
96
Member Avatar for maheshmaks

Hi I am using to design flow to launch 3 Vmware images using queue. Can you please help me. I have just started. If you have links or help related to Vmware launching i.e. 3 images at a time. thanks in advance Regards, Mahesh

0
43

The End.