Remote debugging with boa constructor




I'm a newby on the Python language but I have to modify an excisting pyhon application which runs as a Windows NT service (on 2003 server). I've heared that it's possible to debug an application with boa constructor over the internet, I tried some things what I found on the internet but it doesn't work. Does anybody know how to do this
Debugging is working on a local pc.

tnx
Posted On: Friday 28th of December 2012 05:27:33 AM Total Views:  218
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




Re: Puzzled by "is"

> > Why Because. > > Seriously, it's just an optimization by the implementers. There is no > need for more than one empty tuple, since tuples can never be modified > once created. > > But they decided not to create (1, ) in advance. They probably knew that > hardly anybody would want to create that tuple ;-) [Seriously: if you > started trying to predict which tuples would be used you would go > insane, but the empty tuple is the most likely candidate]. > That's just theorisation but I'd rather expect the interpreter simply not to create a second tuple while there already is an identical one. This could save some memory if the tuple was large (Although by the same token comparison of large tuples can be expensive). Admittedly the empty tuple is a special case but then 'Special cases aren't special enough to break the rules'. A bit odd. Best regards, Greg
VIEWS ON THIS POST

44

Posted on:

Monday 5th November 2012
View Replies!

really small values

In multiplying a value of xe^-325 with ye^-4, Python is returning zero. How do I get it to give me back my tiny value
VIEWS ON THIS POST

155

Posted on:

Monday 5th November 2012
View Replies!

Parse error befor % token

i tried to compile the swig .i file but am having probel with the error: parse error before % token example.i 1. %module example 2. %{ 3. #include 4. %} 5. 6. %include "header.h" i have setup.py file and am running through, >>python setup.py build_ext but is showing parse error before % token in example.i in line 1 and also in 4. Thank's for any help on this matter in advance also, is there any live example having multiple .i files in single interface SWIG file. cheer's
VIEWS ON THIS POST

77

Posted on:

Wednesday 7th November 2012
View Replies!

How to send a POST request?

Hi. Sorry for this very clueless question, but how does one write in Python an HTTP client that can send a POST request The modules I've found (e.g. urllib, urllib2), as far as I can tell, seem to be limited to GET requests. (I could be wrong though; please correct me if this is so.) TIA! kynn -- NOTE: In my address everything before the first period is backwards; and the last period, and everything after it, should be discarded.
VIEWS ON THIS POST

133

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Python, Dutch, English, Chinese, Japanese, etc.

--- MRAB wrote: > Instead of having many different Pythons for many > different languages, > how about one for a language like Esperanto > > http://en.wikipedia.org/wiki/Esperanto > > That could be the language for the standard > libraries instead of > English. > English beats Esperanto by a long shot in terms of practical acceptance. Also, Esperanto's 28-letter alphabet makes it inferior to other written languages that are compatible with Python's current 26-letter alphabet that it inherits from English. >From wikipedia: ''' Because a working knowledge of English is required in certain fields, professions, and occupations, English is studied and spoken by up to a billion people around the world, to at least a basic level... ''' http://en.wikipedia.org/wiki/English_language >From the same article: ''' [When] combining native and non-native speakers [English] is probably the most commonly spoken language in the world, though possibly second to a combination of the Chinese Languages, depending on whether or not distinctions in the latter are classified as "languages" or "dialects." ''' See also: http://en.wikipedia.org/wiki/List_of...ative_speakers ____________________________________________________________________________________ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/
VIEWS ON THIS POST

34

Posted on:

Wednesday 7th November 2012
View Replies!

Vancouver Python Workshop - registration open

What's New =========== Early-bird registration for the Vancouver Python conference is now open. Participants who register before June 30th will receive a substantial discount. To register, see: http://www.vanpyz.org/conference/registration For general conference information, see: http://www.vanpyz.org/conference About the Vancouver Python Workshop =================================== The conference will begin with keynote addresses on August 4st by Guido van Rossum [1] and Jim Hugunin [2]. Further talks (and tutorials for beginners) will take place on August 5th and 6th. The Vancouver Python Workshop is a community organized and designed for both the beginner and for the experienced Python programmer with: * tutorials for beginning programmers * advanced lectures for Python experts * case studies of Python in action * after-hours social events * informative keynote speakers * tracks on multimedia, Web development, education and more More information see: http://www.vanpyz.org/conference/ or contact Brian Quinlan at: brian@sweetapp.com Vancouver ========= In addition to the opportunity to learn and socialize with fellow Pythonistas, the Vancouver Python Workshop also gives visitors the opportunity to visit one of the most extraordinary cities in the world [3]. For more information about traveling to Vancouver, see: http://www.vanpyz.org/conference/vancouver.html http://www.tourismvancouver.com http://en.wikipedia.org/wiki/Vancouver Important dates =============== Talk proposals accepted: May 15th to June 15th Early registration (discounted): May 22nd to June 30th Normal registration: from July 1st Keynotes: August 4th Conference and tutorial dates: August 5th and 6th [1] Guido van Rossum (Google) is the inventor of Python and has managed its growth and development for more than a decade. Guido was awarded the Free Software Foundation Award in 2002 and Dr.Dobb's 1999 Excellence in Programming Award. Guido works at Google and spends half of his time on Python. [2] Jim Hugunin (Microsoft) is the creator of numerous innovations that take Python into new application domains. Jim's most recent project, IronPython integrates Python into Microsoft's .NET runtime. Jim's previous project, Jython is Python for the Java runtime and was the second production-quality implementation of Python. Before that, Jim's Numeric Python adapted Python to the needs of number crunching applications. Jim works at Microsoft adapting the .NET runtime to the needs of dynamic languages like Python. [3] http://news.bbc.co.uk/2/hi/business/2299119.stm Cheers, Brian
VIEWS ON THIS POST

121

Posted on:

Wednesday 7th November 2012
View Replies!

try/except/else/finally problem

I'm using: Python 2.3.2 (#1, Oct 17 2003, 19:06:15) [C] on sunos5 And I'm trying to execute: #! /usr/bin/env python try: f = file('test.txt', 'r') except IOError: print 'except' else: print 'else' finally: print 'finally' And the results are: File "./test.py", line 9 finally: ^ SyntaxError: invalid syntax What am I doing wrong
VIEWS ON THIS POST

129

Posted on:

Saturday 10th November 2012
View Replies!

[ANN] Leipzig Python User Group - Meeting, December 11, 2007, 08:00pm

=== Leipzig Python User Group === We will meet on Tuesday, December 11 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation ...
VIEWS ON THIS POST

34

Posted on:

Saturday 10th November 2012
View Replies!

Finding the selected file in Windows Explorer

Hi! I need to find the selected file(s) in a Windows Explorer window from another program (I'd look at the window that last had focus). I found something in the following page that should do the trick: http://blogs.msdn.com/oldnewthing/ar...20/188696.aspx However, it ...
VIEWS ON THIS POST

136

Posted on:

Sunday 25th November 2012
View Replies!

Re: Problem with write binary data to OLE field in Access

lialie wrote: [... snip slightly confused indication that reading back a binary item using GetChunk appears to double its length ...] Well I don't know why this should be happening, but I do at least have a few suggestions: 1) ...
VIEWS ON THIS POST

57

Posted on:

Sunday 25th November 2012
View Replies!

building psycopg2 on windows using mingw, "cannot find -lpq"

The compile works, BUT linking fails: 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc: \python25\PCBuild -Lc:/p ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build \lib.win32-2.5\psy copg2\_psycopg.pyd c:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lpq collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 if I ...
VIEWS ON THIS POST

276

Posted on:

Sunday 25th November 2012
View Replies!

Block comments

Tomorrow is block comment day. I want them to nest. I think the reason that they don't routinely nest is that it's a lot of trouble to code. Two questions: 1) Given a start and end location (line position and ...
VIEWS ON THIS POST

55

Posted on:

Monday 26th November 2012
View Replies!

ANN: Chandler 0.7.3

The Chandler Project is pleased to announce the 0.7.3 release of Chandler Desktop! Chandler Desktop is an open source, standards-based personal information manager (PIM) built around small group collaboration and a core set of information management workflows modeled on Inbox ...
VIEWS ON THIS POST

45

Posted on:

Monday 26th November 2012
View Replies!

Re: which configparse?

Martin Marcher wrote: > > > On 12/6/07, Neal Becker wrote: >> configparse looks like what I want, but it seems last commit was >2years >> ago. >> >> What is the best choice > > that seems ...
VIEWS ON THIS POST

51

Posted on:

Monday 26th November 2012
View Replies!

Detecting mod_rewrite via CGI

I am using an Apache webserver with mod_rewrite and the cgi module. Is there a way to do the following that isn't completely evil ######## def mod_rewrite_enabled(): try: file = open(os.path.join(os.environ['DOCUMENT_ROOT'], '.htaccess')) except: return False for line in file: ...
VIEWS ON THIS POST

65

Posted on:

Monday 26th November 2012
View Replies!

=?ISO-8859-1?Q?Hi_I_am_anuusha_21years_of_student..._find_your_love?==?ISO-8859-1?Q?r_here_www.loverguru.blogspot.com?=

Hi I am anuusha 21years of student... find your lover here www.loverguru.blogspot.com...
VIEWS ON THIS POST

109

Posted on:

Monday 26th November 2012
View Replies!

Writing event handler for dropdown list in python

I am new to python, Can someone help me with writing event handler for a dropdown list in python. i have one function to create dropdown list in a file def dropdown_options(self,title,options,name,value = None): ret = "\n
VIEWS ON THIS POST

53

Posted on:

Monday 26th November 2012
View Replies!

how to resize a window with a specific name with python-xlib

The python-xlib documentation is confusing for me..and the examples are too few :-( I need simply to resize a window (named "firefox" for example), but before I need the window's id, how can i obtain this id
VIEWS ON THIS POST

75

Posted on:

Monday 26th November 2012
View Replies!

how to figure out if python was used as a cgi script

hi, is there a way to figure out which scripting language was used in a cgi. I used to watch extensions (i.e. py, pl, asp or php) nowadays i hardly see any extensions and really it is hard to find ...
VIEWS ON THIS POST

62

Posted on:

Monday 26th November 2012
View Replies!

CodeInvestigator version 0.6.0 released.

CodeInvestigator version 0.6.0 was released on November 8. This version adds support for input() and raw_input() functions. The main changes: * The 'Details' button on the file selection screen gives access to statistics, stdin and stdout for the running program. ...
VIEWS ON THIS POST

46

Posted on:

Monday 26th November 2012
View Replies!

help

i am working o my first real program, a strategy game when i ran a part of it and it said invalid syn tak and hilighted the colon on line 15 hers the code (Toggle Plain Text) import random,pickle,easygui level=1 money=1000 lives=10 class War: def __init__(self,numsol,tysol,posol,strengh,risk): self.numsol=numsol self.tysol=tysol self.level=level self.money=money self.lives=lives self.posol=posol self.strengh=strengh self.risk=risk def Save: pickle.dump(War,open("savedata.p","wb")) easygui.msgbox("your data has been saved") def Load: class War=pickle.load(open("savedata.p","rb")) easygui.msgbox("game has been loaded level: %l money: %m lives: %d" %l level %m money %d lives) import random,pickle,easygui level=1 money=1000 lives=10 class War: def __init__(self,numsol,tysol,posol,strengh,risk): self.numsol=numsol self.tysol=tysol self.level=level self.money=money self.lives=lives self.posol=posol self.strengh=strengh self.risk=risk def Save: pickle.dump(War,open("savedata.p","wb")) easygui.msgbox("your data has been saved") def Load: class War=pickle.load(open("savedata.p","rb")) easygui.msgbox("game has been loaded level: %l money: %m lives: %d" %l level %m money %d lives)
VIEWS ON THIS POST

72

Posted on:

Tuesday 27th November 2012
View Replies!

how to create a .exe file from a python script

hello i have written a small python script, which includes matplotlib,tkinter and numpy. How can i create a installation file which bundles all the above 3 and my script and python itself. I tried py2exe , it gives me a error "invalid syntax (test1.py) " I am using windows 7 i want to do this so that the persons who receives this .exe file need not install python in their computer
VIEWS ON THIS POST

60

Posted on:

Tuesday 27th November 2012
View Replies!

need help with this grade calculator program PLZ!!

Quote: Originally Posted by titaniumdecoy Since you don't seem to get it... You're clever = What you think it means Your cleaver = Your large knife oh gotcha yea i didn't even notice the spelling mistake
VIEWS ON THIS POST

111

Posted on:

Tuesday 27th November 2012
View Replies!

lists indexes - beginner

Every C I know, which predates C89, handles the offset automatically by multiplying by type size. Admittedly, I've only been using it since 1980.
VIEWS ON THIS POST

76

Posted on:

Tuesday 27th November 2012
View Replies!

Need help adding a loop to restart program

So, I can't seem to get any loop to work in with this program to calculate average test scores. This is for a lab i need to finish by tomorrow so I need urgent help haha. so far this is what I have; (Toggle Plain Text) score = 0 totalScores = 0 averageScores = 0 students = raw_input("How many students took the test") students = int(students) for counter in range( students ): score = input("Enter a score") totalScores = score + totalScores averageScores = totalScores/students print"The average test score is:",averageScores score = 0 totalScores = 0 averageScores = 0 students = raw_input("How many students took the test") students = int(students) for counter in range( students ): score = input("Enter a score") totalScores = score + totalScores averageScores = totalScores/students print"The average test score is:",averageScores
VIEWS ON THIS POST

119

Posted on:

Tuesday 27th November 2012
View Replies!

Quadratic Formula in Python

But don't be fooled by what "%si" is doing... I'm not sure if it's clicked yet, but it's nothing magical. It's saying "replace %s with one of the variables, and print it next to the letter 'i'". So print "%si"%("Aaron"), will output "Aaroni", for example. Nothing to do with complex numbers really. Just a trick, that's all.
VIEWS ON THIS POST

38

Posted on:

Tuesday 27th November 2012
View Replies!

Arithmetic By Percentage

That's the OP's call. He said "short", not "looks short." Abstraction has its uses. As a means of programmer productivity at the expense of performance, I think this one has already failed.
VIEWS ON THIS POST

42

Posted on:

Tuesday 27th November 2012
View Replies!

The Demise of lambda, map, filter and reduce

But, on the other hand: (Toggle Plain Text) [i * i for i in l if i % 2 == 0] [i * i for i in l if i % 2 == 0]
VIEWS ON THIS POST

53

Posted on:

Tuesday 27th November 2012
View Replies!

Hard understanding part of tutorial

http://ibiblio.org/obp/thinkCS/pytho...h/chap09.htm#4 I am doing this tutorial, but when it comes to the exercise in this part 9.4 I'm stuck, I do not understand the high and low thing, what does he mean with that Quote: To generate a random number between 0.0 and an upper bound like high, multiply x by high. As an exercise, generate a random number between low and high.
VIEWS ON THIS POST

90

Posted on:

Tuesday 27th November 2012
View Replies!

GIL and concurrency challenges in Python

Interesting article on what is probably the single biggest drawback to using python. http://www.jeffknupp.com/blog/2012/0...rdest-problem/ Even without efficient parallelism, its better than perl
VIEWS ON THIS POST

46

Posted on:

Wednesday 28th November 2012
View Replies!

alternative for eval?

The function eval() in Python breaks very easily when used to convert a string into a number. you need to do is input a value with a leading zero. Any idea why So if you have code like: x=input("Please enter a number: ") val=eval(x) print(x) And you run it with a value of: 015 It fails and issues: SyntaxError: invalid token What's a good way to ensure no error (without trimming leading zeros).
VIEWS ON THIS POST

49

Posted on:

Wednesday 28th November 2012
View Replies!

pygame help!

this my code (Toggle Plain Text) import pygame.sprite import os.path import os, sys import pygame from pygame.locals import * if not pygame.font: print 'Warning, fonts disabled' if not pygame.mixer: print 'Warning, sound disabled' def load_image(name, colorkey = None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot load image:', name raise SystemExit, message image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect() def load_sound(name): class NoneSound: def play(self): pass if not pygame.mixer: return NoneSound() fullname = os.path.join('data', name) try: sound = pygame.mixer.Sound(fullname) except pygame.error, message: print 'Cannot load sound:', wav raise SystemExit, message return sound class Fist(pygame.sprite.Sprite): """moves a clenched fist on the screen, following the mouse""" def __init__(self): pygame.sprite.Sprite.__init__(self) #call Sprite initializer self.image, self.rect = load_image('fist.bmp, -1') self.punching = 0 def update(self): "move the fist based on the mouse pisition" pos = pygame.mouse.get_pos() self.rect.midtop = pos if self.punching: self.rect.move_ip(5, 10) def punch(self, target): "returns true if the fist collides with the target" if not self.punching: self.punching = 1 hitbox = self.rect.Inflate(-5, -5) return hitbox.colliderect(target.rect) def unpunch(self): "called to pull the fist back" self.punching = 0 class Chimp(pygame.sprite.Sprite): """moves a monkey critter acreoss the screen. it can spin the monkey when it is punched.""" def __init__(self): pygame.sprite.Sprite.__init__(self) #call Sprite initializer self.image, self.rect = load_image('chimp.bmp, -1') screen = pygame.display.get_surface() self.area = screen.get_rect() self.rect.topleft = 10, 10 self.move = 9 self.dizzy = 0 def update(self): "walk or spin, depending on the monkeys state" if self.dizzy: self._spin() else: self._walk() def _walk(self): "move the monkey across the screen, and turn at the ends" newpos = self.rect.move((self.move, 0)) if not self.area.contains(newpos): if self.rect.left < self.area.left or\ self.rect.right > self.area.right: #error self.move = -self.move newpos = self.rect.move((self.move, 0)) self.image = pygame.transform.flip(self.image, 1, 0) self.rect = newpos def _spin(self): "spin the monkey image" center = self.rect.center self.dizzy += 12 if self.dizzy >= 360: self.dizzy = 0 self.image = self.original else: rotate = pygame.transform.rotate self.image = rotate(self.original, self.dizzy) self.rect = self.image.get_rect(center = center) def punched(self): "this will cause the monkey to start spinning" if not self.dizzy: self.dizzy = 1 self.original = self.image pygame.init() screen = pygame.display.set_mode((468, 60)) pygame.display.set_caption('Monkey Fever') pygame.mouse.set_visible(0) background = pygame.Surface(screen,get_size()) background = background.convert() background.fill((250, 250, 250)) if pygame.font: font = pygame.font.Font(None, 36) text = font.render("Pummel The Chimp, And Win $$$", 1, (10, 10, 10)) textpos = text.get_rect(centerx = background.get_width()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() whiff_sound = load_sound('whiff.wav') punch_sound = load_sound('punch.wav') chimp = Chimp() fist = Fist() allsprites = pygame.sprite.RenderPlain((fist, chimp)) clock = pygame.time.Clock() while 1: clock.tick(60) for event in pygame.event.get(): if event.type == QUIT: return elif event.type == KEYDOWN and event.key == K_ESCAPE: return elif event.type == MOUSEBUTTONDOWN: if fist.punch(chimp): punch_sound.play() #punch chimp.punched() else: whiff_sound.play() #miss elif event.type == MOUSEBUTTONUP: fist.unpunch() allsprites.update() screen.blit(background, (0, 0)) allsprites.draw(screen) pygame.display.flip() #error import pygame.sprite import os.path import os, sys import pygame from pygame.locals import * if not pygame.font: print 'Warning, fonts disabled' if not pygame.mixer: print 'Warning, sound disabled' def load_image(name, colorkey = None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot load image:', name raise SystemExit, message image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect() def load_sound(name): class NoneSound: def play(self): pass if not pygame.mixer: return NoneSound() fullname = os.path.join('data', name) try: sound = pygame.mixer.Sound(fullname) except pygame.error, message: print 'Cannot load sound:', wav raise SystemExit, message return sound class Fist(pygame.sprite.Sprite): """moves a clenched fist on the screen, following the mouse""" def __init__(self): pygame.sprite.Sprite.__init__(self) #call Sprite initializer self.image, self.rect = load_image('fist.bmp, -1') self.punching = 0 def update(self): "move the fist based on the mouse pisition" pos = pygame.mouse.get_pos() self.rect.midtop = pos if self.punching: self.rect.move_ip(5, 10) def punch(self, target): "returns true if the fist collides with the target" if not self.punching: self.punching = 1 hitbox = self.rect.Inflate(-5, -5) return hitbox.colliderect(target.rect) def unpunch(self): "called to pull the fist back" self.punching = 0 class Chimp(pygame.sprite.Sprite): """moves a monkey critter acreoss the screen. it can spin the monkey when it is punched.""" def __init__(self): pygame.sprite.Sprite.__init__(self) #call Sprite initializer self.image, self.rect = load_image('chimp.bmp, -1') screen = pygame.display.get_surface() self.area = screen.get_rect() self.rect.topleft = 10, 10 self.move = 9 self.dizzy = 0 def update(self): "walk or spin, depending on the monkeys state" if self.dizzy: self._spin() else: self._walk() def _walk(self): "move the monkey across the screen, and turn at the ends" newpos = self.rect.move((self.move, 0)) if not self.area.contains(newpos): if self.rect.left < self.area.left or\ self.rect.right > self.area.right: #error self.move = -self.move newpos = self.rect.move((self.move, 0)) self.image = pygame.transform.flip(self.image, 1, 0) self.rect = newpos def _spin(self): "spin the monkey image" center = self.rect.center self.dizzy += 12 if self.dizzy >= 360: self.dizzy = 0 self.image = self.original else: rotate = pygame.transform.rotate self.image = rotate(self.original, self.dizzy) self.rect = self.image.get_rect(center = center) def punched(self): "this will cause the monkey to start spinning" if not self.dizzy: self.dizzy = 1 self.original = self.image pygame.init() screen = pygame.display.set_mode((468, 60)) pygame.display.set_caption('Monkey Fever') pygame.mouse.set_visible(0) background = pygame.Surface(screen,get_size()) background = background.convert() background.fill((250, 250, 250)) if pygame.font: font = pygame.font.Font(None, 36) text = font.render("Pummel The Chimp, And Win $$$", 1, (10, 10, 10)) textpos = text.get_rect(centerx = background.get_width()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() whiff_sound = load_sound('whiff.wav') punch_sound = load_sound('punch.wav') chimp = Chimp() fist = Fist() allsprites = pygame.sprite.RenderPlain((fist, chimp)) clock = pygame.time.Clock() while 1: clock.tick(60) for event in pygame.event.get(): if event.type == QUIT: return elif event.type == KEYDOWN and event.key == K_ESCAPE: return elif event.type == MOUSEBUTTONDOWN: if fist.punch(chimp): punch_sound.play() #punch chimp.punched() else: whiff_sound.play() #miss elif event.type == MOUSEBUTTONUP: fist.unpunch() allsprites.update() screen.blit(background, (0, 0)) allsprites.draw(screen) pygame.display.flip() #error
VIEWS ON THIS POST

107

Posted on:

Wednesday 28th November 2012
View Replies!

Complete new needs help with code

I'm new here. Hi . I'm just learning python and I'm stumped trying to get this to work. Python Syntax (Toggle Plain Text) print "How old are you",age = raw_input (36)print "how tall are you",height = raw_input (6)print "How much do you weigh",weight = raw_input (200)print "So, you are %r old, %r tall, and %r heavy." %(age, height, weight) print "How old are you", age = raw_input (36) print "how tall are you", height = raw_input (6) print "How much do you weigh", weight = raw_input (200) print "So, you are %r old, %r tall, and %r heavy." %(age, height, weight)
VIEWS ON THIS POST

64

Posted on:

Wednesday 28th November 2012
View Replies!

Calculate CRC32 checksums (like SFVs)

(Toggle Plain Text) import binascii def getCRC(filename): filedata = open(filename).read() return binascii.crc32(filedata) import binascii def getCRC(filename): filedata = open(filename).read() return binascii.crc32(filedata)
VIEWS ON THIS POST

65

Posted on:

Wednesday 28th November 2012
View Replies!

Are nested lists indestructable?

I am trying to create a program that involves writing a whole bunch of lists with information of its specific topic then grouping them together. Normally I would use a hash but they don't really let you create a whole bunch of variables that can be withdrawn later. So my problem is when I nest them together, based on a random factor I want to delete so many of them from the back, but nothing I write seems to work I can see doing all this with a whole bunch of if: loops but I know there has to be some easier way here is my program(at least the part that pertains to it) (PS. all the importing and preperations are done I simply didn't print it) a=randint(6,11) aa=['name', 'att', 'def', 1] ab=['name', 'att', 'def', 1] ac=['name', 'att', 'def', 1] ad=['name', 'att', 'def', 1] ae=['name', 'att', 'def', 1] af=['name', 'att', 'def', 1] ag=['name', 'att', 'def', 1] ah=['name', 'att', 'def', 1] ai=['name', 'att', 'def', 1] aj=['name', 'att', 'def', 1] abspirlist=[aa,ab,ac,ad,ae,af,ag,ah,ai,aj] del abspirlist[a:] shuffle(abspirlist)
VIEWS ON THIS POST

61

Posted on:

Wednesday 28th November 2012
View Replies!

Catching only one word

Using this code to get a sequence of 'words' (well, numbers, but that's irrelevant) separated by a space, it fails at the split(" ") when only one word is given (I assume). However, it doesn't raise an exception and I'm unsure on how to catch the single word anyway. (Toggle Plain Text) def GetSequence(highNumber): while 1: sequence = GetString("Enter a Sequence of numbers separated by a space: ") try: list = [] for word in sequence.split(" "): list.append(int(word)) except ValueError: print "Error: '%s' is not a number! Try again." % word, continue except: print "Error! Try again.", continue break return list def GetSequence(highNumber): while 1: sequence = GetString("Enter a Sequence of numbers separated by a space: ") try: list = [] for word in sequence.split(" "): list.append(int(word)) except ValueError: print "Error: '%s' is not a number! Try again." % word, continue except: print "Error! Try again.", continue break return list
VIEWS ON THIS POST

45

Posted on:

Wednesday 28th November 2012
View Replies!

Python IDE

I'm on a seemingly eternal quest for a good and free python IDE. My criteria:Syntax Highlighting Autocompletion/tooltips Integrated and user-friendly debugger Integrated shell that can be restarted independently of the editor I've used IDLE, Pywin, Py (part of wxPython), DrPython and SPE. I like SPE, but the debugger is the powerful but (to me, at least) unwieldy winpdb and the shell can't be restarted without closing the editor. Also, the integrated Pychecker doesn't seem to work on my system. Any recommendations , DrPython does all of the above. What don't you like about it You have to install a few plug-ins (download and install from within DrPython). , Quote: Have you used it Indeed I have. I do almost all of my C++ development on it, and keep up to date with relevant updates concerning it. Half of the features you mentioned there are KatePart specific, and were not requested as features required in the IDE... Quote: Originally Posted by Silvanus Autocompletion/tooltips Nope. Quote: Originally Posted by Silvanus Integrated and user-friendly debugger Quote: Originally Posted by iignatus Debugger Check. What Where Show me where the Python debugger is.. last time I checked, KDevelop can only make use of valgrind or gdb with C++. Quote: Integrated shell that can be restarted independently of the editor If you mean Python shell, then no. KDevelop does embed a KonsolePart that can, obviously, be used independantly of the editor (Menu->Run->`konsole`), but Konsole is a terminal, not a Python shell. , Quote: Integrated python shell right there, no I think he's talking about graphical shells like PyCrust/IDLE. Thats what it sounds like, at least.
VIEWS ON THIS POST

63

Posted on:

Wednesday 28th November 2012
View Replies!

While And Random Problem [solved]

G'day all I am working my way through a book called "Python programming for absolute beginners" (I have very little programming experience) and at the end of one chapter you are asked to write a simple coin toss programme that tosses a coin 100 times and prints the result of each toss either as "heads" or "tails" using a while loop. I can get the random to work without the loop but I can't get it working properly using the loop, each toss is exactly the same (eg 100 instances of "heads"), though randomly it will change to the other and every time I run the programme for some time it will generate that. Here is the code: (Toggle Plain Text) # Coin Toss programme # Flips 100 coins and reports heads or tails # Stuart Graham 10/12/04 import random coin = random.randrange(2) count = 0 toss = int(raw_input("enter number of tosses ")) while (count < toss): * *if (coin == 0): * *print "heads", coin *else: #(coin == 1) * *print "tails", coin *count += 1 # Coin Toss programme # Flips 100 coins and reports heads or tails # Stuart Graham 10/12/04 import random coin = random.randrange(2) count = 0 toss = int(raw_input("enter number of tosses ")) while (count < toss): * *if (coin == 0): * *print "heads", coin *else: #(coin == 1) * *print "tails", coin *count += 1
VIEWS ON THIS POST

147

Posted on:

Wednesday 28th November 2012
View Replies!

Heads or Tails

Here's the relevant part isolated: (Toggle Plain Text) counter = 1 if(counter > maximum): maximum = counter counter = 1 if(counter > maximum): maximum = counter, in a row assuming that the coin is unbiased, 0.5 to the power of X i think.. Where X is the number of times played, and 0.5 is the prob that you will win on the first game. X(E)Z X > 0 So if you play twice, it is 0.25, play three times and it is 0.125 etc My rather basic memory of stats is coming back to me. I always found it boring to be honest. The only time that I have ever used it in any capacity, in CS, is implementing simulation (used to randomly generate random people roaming each street in games like GTA, for example). And even then you are not actually calculating probability. You are generating a number and using that to generate an event, with events assigned depending on the number that you get. You can use it to control virtual rats through a series of virtual pipes, for example , an infinite number of times played would be interpreted as zero, in which case you would both have a 100% chance of winning, meaning that it is impossible, since 1+1 is 2 and you cant have that in probability the only truth would be that for each game you haze a 0.5 chance either way. By the way, I failed stats at college. I'm just using common sense, which doesnt work in stats, please take what I tell you with a pinch of salt.
VIEWS ON THIS POST

118

Posted on:

Friday 28th December 2012
View Replies!

Few questions about python/programming.

, I'm new to the whole programming scene and have been interested in doing this for a while. I started doing an online tutorial for python, I have a few questions. 1. How do I apply my python language to "real" programs, I only seem to be doing text based programs. Can python apply this to "real" programs, for example a program to do a scheduled task (windows does this in the control panel, but just for an example) 2. Whats the learning curve I have heard python is supposed to be easy, how long until i can start making said "real" programs, how much time per day/week should I spend programming, I may not have a lot of time once college starts (i'im asking for a reference or guide to how much can be done per day to still progress)
VIEWS ON THIS POST

88

Posted on:

Friday 28th December 2012
View Replies!

Beginers Python Tutorial

This is a tutorial I originaly wrote for the hackers.com forum... but since that forum was taken down for the better part of the year I'll bring the tutorial here... 1. Intro Now what is Python Well Python is a very powerful programming language that can be used for many things like Basic Adding to somewhat Complex Shell Programming and CGIs it is also very simple to learn, this is a good language to learn if you are new to programming. This tutorial is written for people who have never programmed before so dont expect to learn how to do any complex programs, Just Yet You can download Python at the link below: (Toggle Plain Text) http://www.python.org http://www.python.org
VIEWS ON THIS POST

70

Posted on:

Friday 28th December 2012
View Replies!

Need Help Cant Find Download

i need help b/c i cant find a download for python any where.
VIEWS ON THIS POST

94

Posted on:

Friday 28th December 2012
View Replies!

Keeping Window Open :\

K, I'm a complete noob when it comes to python. I have no experience in it what-so-ever. So you might be getting a lot of these posts from me... little lame things... Now, how do you keep a python window open When I do the print command, it doesn't stay open. Noobular, I know... but still. How
VIEWS ON THIS POST

86

Posted on:

Friday 28th December 2012
View Replies!

Python is where it starts.

Thanks
VIEWS ON THIS POST

77

Posted on:

Friday 28th December 2012
View Replies!

from MID() in VB to Python?

do anyone know the equivalent of the function MID() in VB, for Python thx in advance...
VIEWS ON THIS POST

77

Posted on:

Friday 28th December 2012
View Replies!

Decrypt the password

Hi , Good morning, I'm doing a small application using python and mysql. I have encrypted the password using md5. but it is one way algorithm. It means it only encrypts the password but while we are retriving the password it should check the given plain text with the encrypted text but it is not possible in md5. Is there any other algorithm is there then please tell me. This is the sample code: import md5 password = md5(password) this encrypts the password. but it is not decrypts the password. Please help me.
VIEWS ON THIS POST

68

Posted on:

Friday 28th December 2012
View Replies!

Looking for opinions on structure for a group of encryption functions

I'm coding a group of functions that performs various historical encryption functions on a plaintext, and I'm wondering what structure would be best. The couple of options I'm tossing around are: a) making a class plaintext that contains these functions and performs them on the plaintext passed in. I would import this plaintext class from a module (probably called plaintext, cipher, something like that) b) skipping the class step and simply making a module that contains all the functions and just importing that module. I'm open to any other suggestions, too. I realize it's a pretty open-ended question, but I'm interested in your input.
VIEWS ON THIS POST

45

Posted on:

Friday 28th December 2012
View Replies!

Redirecting Console Output

I need to redirect all console output (including error messages) to a log file. There are several reasons why I would have to go out of my way to change each print statement to a call to a function. It would be much easier if there's some support in the sys library for just that
VIEWS ON THIS POST

78

Posted on:

Friday 28th December 2012
View Replies!

New to Functions

Hi. This is my first program with the use of functions. Could I get some opinions Could it be improved at all (Toggle Plain Text) #By Snipertomcat #Area Calculator w/ menu interface def menu_options(): #Getting all the def's squared away print "Welcome to Area-Calc." print "Options:" print " 'p' print options" print " 'r' calculate area of a rectangle " print " 's' calculate area of a square " print " 'c' calculate area of a circle " print " 'q' quit the program" def area_rec(width,height): return width*height def area_square(num): return num*num def area_circle(radius): return 3.14 * radius **2 menu_options() #Program starts here choice = "p" while choice != "q": if choice == "r": w = input("Rectangle width: ") h = input("Rectangle hight: ") print "The area is: ",area_rec(w,h) elif choice == "s": squarenum = input("Square length: ") print "The area is: ", area_square(squarenum) elif choice == "c": rad = input("Radius: ") print "The area is: ", area_circle(rad) choice = raw_input("Option: ") #By Snipertomcat #Area Calculator w/ menu interface def menu_options(): #Getting all the def's squared away print "Welcome to Area-Calc." print "Options:" print " 'p' print options" print " 'r' calculate area of a rectangle " print " 's' calculate area of a square " print " 'c' calculate area of a circle " print " 'q' quit the program" def area_rec(width,height): return width*height def area_square(num): return num*num def area_circle(radius): return 3.14 * radius **2 menu_options() #Program starts here choice = "p" while choice != "q": if choice == "r": w = input("Rectangle width: ") h = input("Rectangle hight: ") print "The area is: ",area_rec(w,h) elif choice == "s": squarenum = input("Square length: ") print "The area is: ", area_square(squarenum) elif choice == "c": rad = input("Radius: ") print "The area is: ", area_circle(rad) choice = raw_input("Option: ")
VIEWS ON THIS POST

228

Posted on:

Friday 28th December 2012
View Replies!

Keeping Your Publicly Released Programs...

Keeping Your Publicly Released Programs Automatically Updated Program: This will be run with Python once an update has or hasn't occured. Web Directory: The Update Instructions and Contents are here. Version Data: Contains a number with the current version number, in the same folder as the program and this file. Update Instuctions: Contains a number which if higer then the version number, will process all the listed files underneath to current working directory. Version Data: (Toggle Plain Text) 1 1
VIEWS ON THIS POST

261

Posted on:

Friday 28th December 2012
View Replies!