19,161 Topics
Hi, I am using Python's urllib2 with Tor as a proxy to access a website. When I open the site's main page it works fine but when I try to view the login page (not actually log-in but just view it) I get the following error... URLError: To counteract this …
Is it possible? I need to use them with wxpython and I'd want to make a standalone program that contains them into the exe file.
hi i'm new to daniweb. interests: c++, python, c# (sometimes) i'm doing audio visual software for nintendo ds and pc as a hobby. an ongoing project is about cellular automata which are used to make sound. check <URL SNIPPED> cheers
Hi, I hope you can help; I get this error when I compile a "C" sub module (NOT POSIX) 27 ! regmatch_t pmatch[2]; ===========> ............a......b............................................... *=ERROR===========> a - CCN3766 The universal character name "[" is not in the allowable range for an identifier. *=ERROR===========> b - CCN3275 Unexpected text ']' …
hello all, how can i write a python line of codes that will contain WI-FI, google maps,google android applications on S60 nokia phone using a SKYHOOK wireless device as an acess point and the operating system must be symbian OS. But i have S60 developmental tools and S60wpsapi which i …
I'm attempting to search a string for a certain sequence. I have not done anything with re, and it is... a bit confusing. I'm looking for this string: <div class="indexcenter"> (there's a portion of text here using newlines and characters) <!-- end indexcenter --> I am thinking something alone these …
Hi all. I'm making a program about 'reading and writing text files' The assignment I have to do is suppose to look like this: [url]http://i39.tinypic.com/5554wi.jpg[/url] But I can't figure it how to make it so when it keeps looping until the user types in 'break' and it will list the …
I'm trying to print diff.txt that contains the differences between the 2 log files I have. I want it to print the diff.txt in the current directory, but I get nothing. [code] def difference(dirList1, dirList2): difFile = list(set(dirList1).difference(set(dirList2))) writeDif = open( 'diff.txt', 'w' ) writeDif.write( 'Yadda yadda, intro intro' ) …
This demonstration was originally proposed to be posted as a Python tutorial but with further inspection it was deemed more of a "how-to" guide, in this case, how-to create simple animation via Tkinter (Tool Kit Interface) All the necessary elements are included in the attched zip file. This includes: [LIST] …
How would you count how many opening HTML tags there were & then closing tags in a line? eg [CODE] for line in something: for match in re.match("[I]opening_regex_here[/I]",line): # will match <H1> or <html> or whatever opentags += 1 for match in re.match("[I]closing_regex_here[/I]",line): # will match <H1> or </html> or …
I have a string, say for example: [CODE]str="aasd<script>"[/CODE] How do I make Python to note down one character at a time until it encounters the '<'? I know it has to be a loop, but which function? Thanks
Hey guys.... I use Python 2.6.2. I recently created a program which accepts commands from my website, here's the code I used: [CODE]import urllib import subprocess import time open_site=urllib.urlopen("http://www.sravan953.webs.com/command_python.htm") read_site=open_site.read() def run_program(): current=time.asctime() print 'Runnning program'+' ['+current+']' subprocess.call(read_site) def check_argument(): current=time.asctime() if read_site=='': print 'No command given'+' ['+current+']' timer() else: …
how to write " how are you " in a text file and read the file and display the contents..can anyone tell me the code for this?
I am using pygame I want my program to read an image file that only has black on it and whenever the character moves over a part that has black on it, he stops moving, any ideas on how to get started? The black image is not to be shown.
I have the following script: [CODE] import sys import os import re pages = [] if len(sys.argv) > 1: for root, dirs, files in os.walk(sys.argv[1]): for f in files: filename = os.path.join(root, f) if (filename.endswith('.html')) or (filename.endswith('.htm')): pages.append(filename) for page in pages: f = open(page, "r") count = 1 for …
Hi, is there an internal module / method to change the colour of the text in the pythonwin? I am asking this so that I can make more exciting text based games
Hi, I'm trying to build a web server in Python, and here is what I have so far: [CODE] Code: from http.server import HTTPServer, BaseHTTPRequestHandler class RequestHandler(BaseHTTPRequestHandler): def _writeheaders(self): self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() def do_HEAD(self): self._writeheaders() def do_GET(self): self._writeheaders() self.wfile.write("""<HTML> <HEAD><TITLE>Sample title</TITLE></HEAD> <BODY>sample text</BODY> </HTML>""") serveraddr = ('', 8080) srvr …
I'm stuck trying to get mechanize working as part of a larger project I'm working on. I'm trying to logon to the following website which I am registered at (but not as "bob" as below obviously): [url]http://www.morningstar.co.uk/uk/membership/signup.aspx?loginType=1&lastvisit=%2fuk%2fportfoliomanager%2fportfolio.aspx%3fSite%3duk%26lang%3den-GB[/url] I think I've managed to select the correct form (?) but I'm getting …
Hey I'm new here registered today. I've been trying to import some definitions from other .py files in the same folder, but for some reason IDLE wont recognize/ import them and keeps telling me they arent defined. I have tried From file import * and was wondering if my syntax …
I am an undergraduate Student, from Computer Science and engineering department I can construct a crawler in Perl, for one particular web-site to fetch the useful information, in my case the - Job Ads at that company's webpage. Now, I want to construct some crawler that is generalized for say …
I'm brand new to python, so i need a bit help parsing. Why i need parsing? so my irc bot can reconignise me. here is my code: [CODE]#### # Made by Fellixombc # pythonbots.no-ip.org:8080 (coming soon) # Contact: [email protected] (add me on msn, I don't check my email's) # Copyright …
can anyone explain me staic vs instance method ..what are the differnce ?
Hello! I recently started learning Python, and I'm trying to install the package GASP ([url]http://pypi.python.org/pypi/gasp/0.4.5[/url]) in order to be able to code some graphics. However, the file is of type EGG. I found that I need to install EasyInstall in order to be able to install EGG files. (The download …
Hi all, I'm trying to write a video player with wxpython and pygst. The main Frame has one panel and one notebook. On one page of the notebook, I need to play multiple videos at the same time. On this page, I declare two CameraPanel instances (code below) and put …
Hi, I have this code: [code=python] def yn(input): if input.lower == 'y': return True else: return False def limestone(): I = raw_input("are there shelly fragments? (y/n)") if yn(I): print "Shelly limestone" else: print "chalk" def crystals(): I = raw_input("Are the crystals big?(y/n)") if yn(I): big_crystals() else: print "Basalt" def big_crystals(): …
I'm having a simple problem. I'm using this class to do some stuff with another module. Now, for some reason the self.database and other variables are not able to be accessed by the other methods. I thought _init_ was suppose to work as a constructor, thus the other methods should …
How do I search a string for anything? What I mean is, I need to say: [code=python] if line == 'playername = (any name)': temp = line.strip().replace('playername=', '') return temp [/code] Any ideas?
Hi guys, Im embarking on something new (to me). Im creating a matchign expression system for a music video collection app. Essentially for the program to find the files, the user inputs a mask to help find the files and identify tags in the file name. e.g %artist%\%artist% - %title%.%ext% …
Ok, so this is kind of a complicated question... but... Ok so I have a python script, you enter some numbers it gives you some numbers back that sort of thing. But of course right now it just looks like a black window with text. kind of like [URL="http://blog.benhall.me.uk/images/InstallingWindows2008EnterpriseCoreServe_F3A1/6Cmd.jpg"]this.[/URL] But …
Hello everyone,i am pretty new to GUI programming,am currently playing around with PyQt4.I would like to know how the ui for yahoo was created.Because the controls provided by pyqt are just normal gray-colored stuffs.Could it be that those fancy control or widgets are graphical images done with photoshop,gimp etc? Please …
I need to take a text file of a number of gene sequences in fasta format eg >geneA agctactactacgatcgaacgtagctactactacgatcgaacgtagctactactacgatc gaacgtagctactactacgatcgaacgtagctactactacgatcgaacgtagctactact acgatcgaacgtagctactactacgatcgaacgtagctactactacgatcgaacgtagct actactacgatcgaacgtagctactactacgatcgaacgtagctactactacgatcgaac gtagctactactacgatcgaacgtactacgatcgaacgta and put it into: geneA agctactactacgatcgaacgtagctactactacgatcgaacgtagctac where all of the sequence is on one line. I can concatenate it in excel for one sequence but i have …
Hi, I have never been into sockets, so I decided to dive in. With some help from devshed, I managed to make a server as shown below. But I cant get it receive data from client. Please correct me :) ERROR: socket.error: (10057, 'Socket is not connected') [CODE=python] import socket …
[CODE]def who_knows(a, b): """ a and b are lists """ c = [] for i in a: if is_mem(b, i): c.append(i) return uniqify(c) def is_mem(a, elem): for i in a: if i == elem: return True return False def uniqify(arr): b = {} for i in arr: b[i] = 1 …
how can you find out only time interval in given time like start time in hh:mm and end time hh:mm please help me. thanks
this is another pretty simple question, but i've been trying to do it, and cant get it basically what i need is pretty simple, its like say you have a list of 5 numbers. now you need to print out all the lists of possible 3 numbers from those 5 …
Hi to all, I'm working in a application that needs to replace a certain string from a file. I need to create like a dictionary, I'll explain my self. 1. I need to search the string 'class.type=' 2. The string can be in the file like: class.type=var; or class.type =var; …
im sorry this is kind of a silly question i know, but does anyone know any succesful ways to change a .py into a .exe? like so that someone without python installed on their computer can run it? i've seen this topic in a couple places but everything i've tried …
I am working on a script that will eventually run as scheduled via chron. This script will access ftp site and download most recent file added to directory. As I want this to be automatic, I wont have a file name to pass. How do I tell python which file …
write the program to count the number of lines in a given string ... s="hello,\n+ I am \n+"fine\n: 2.how we can display only last file
Hello, I am trying to embed a html file (a report from sql) in to a word document in a particular location. I am trying to get this done using the Office Interop. 1) How can I embed a html file in to a word document ? 2) How can …
So, I always thought that it was possible to return dictionaries in Python. I was wanting to do this because I would prefer not to use globals. However, I am having trouble with returning my dictionary. Code: [code=python] #!/usr/bin/python # 6/9/09 def loadWords(): pathstart = "/home/foo/Documents/PyScripts/Vocab/Lists/" print "What is the …
I've been tearing my hair out for 2 days over this, hopefully someone here can help me. I'm trying to scrape the price data off the following webpage: [URL="http://www.morningstar.co.uk/UK/snapshot/snapshot.aspx?lang=en-GB&id=F0GBR04S4X"]http://www.morningstar.co.uk/UK/snapshot/snapshot.aspx?lang=en-GB&id=F0GBR04S4X[/URL] The value I want currently stands at 6.19 (i.e. the NAV value on the right hand side). I currently have a …
nowadays,i think i am the first man of trying to develop an ai program. the basic workflow is read two files,one input file(this file is generated computer peripheral OCR equipment) and another(this file is generated by customs expected result,it's made-to-order by miscellaneous software,in future,this kind of results or problems can …
Hi all, I'm developing a system in Python. When the app has been a time running, its CPU consumption goes from 10% to 96% and stays there until I close it. Has anyone been in this situation and has a clue to solve it? My program uses Threads, pyserial and …
I am using the OptionMenu with Tkinter. I have found that sometimes when I use the OptionMenu widget, I encounter a problem. After the user clicks on the OptionMenu and selects an option, sometimes other widgets such as buttons in the window will not work until the user clicks somewhere …
Hello. I'm having trouble about drawing a border around a listctrl [code]"""Main module for psutils GUI""" __version__ = "$Revision: 8 $" # $Source$ import random import wx import psutil ID_EXIT = 110 class MainGUIFrame(wx.Frame): """Main frame. Shows processes and graph""" def __init__(self): """Initialization of the frame""" wx.Frame.__init__(self, None, -1, "psutils", …
Hey guys.. I have been making a random password maker, which makes a password of 8 characters length, but I am encountering a problem. Here'e the code I used: [CODE]import random list=['a','b','c','d','e','f','g','h','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','!','@','#','$','%','^','&','*'] randlist='' a=1 def password(): while a<=8: randlist+=random.choice(list) a+=1 return password() print randlist print 'Are you satisfied with your …
Hello, I have file name is file.txt inside it this lines line1=hello world line2=hello web line3=hello egy I want print full lines start with line2= like in linux command cat file.txt | grep "line2=" this code will print full line --> line2=hello web And if any one have books in …
Hello All Can crystal reports be generate in Python ? Any suggestions plz??
So - after spending quite a few hours enjoying the site, I joined - and promptly made one of the classic "newbie" mistakes! I answered a question before I had seen the other answers - please forgive! It won't happen again! :( I am very old and currently trying to …
The End.