15,190 Topics

Member Avatar for
Member Avatar for Godflesh

I have a problem again :) I try to use this code: [code] import time from threading import Thread from threading import Lock def main(): for i in range(3): my_thread = MyThread(i) my_thread.start() class MyThread(Thread): lock = Lock() def __init__(self, i): Thread.__init__(self) self.i = i def run(self): while True: self.lock.acquire() …

Member Avatar for jcao219
0
379
Member Avatar for breakbone

hi all I'm writing a application which uses Opencv and wxWidgets and sends camera frames via a socket connection. But it seems i'm doing something wrong: after starting a server on my machine, i can't connect my application to the socket the server is listening on...why is that? [CODE=python] import …

Member Avatar for breakbone
0
101
Member Avatar for Godflesh

How do i make this code to store data in a global variable, it create random number of elements. [code] n = random.randint(0, 99) for i in range(1): print "-"*60 print "Here is some new elements! " while n >= 0: data_list = random.randint(0,99) print data_list, time.sleep(.10) n= n-1[/code]

Member Avatar for Godflesh
0
310
Member Avatar for gangster88

I need to have 4 functions which asks the user how many times to flip the coin and then displays the number of heads and the number of tails as a decimal? [code] def getInputs(): times=input("please enter the number of times the coin should be flipped: ") def simulateFlips(): for …

Member Avatar for charlottetemp
0
1K
Member Avatar for Tech B

I've seen a program called Devcon ([url]http://en.kioskea.net/faq/sujet-1886-enable-disable-a-device-from-the-command-line[/url]) used for enabling and disabling hardware devices. I want to do the same hopefully with python. I want to turn the internet connection off with a script. I can already do it with popen('ipconfig /release') but I want something more robust. Is there …

Member Avatar for Tech B
0
2K
Member Avatar for subhan222

Hi, I am trying to embed python in c++. everything is working fine apart from couple of issue. what exactly i am doing is creating an API for C++ functions in my application to be accessible using python script. When i run a script its runs fine and when i …

0
106
Member Avatar for sandeep.m

Hi, I am facing a problem when i am trying to run the django server using python manage.py runserver.The problem is that the server is not starting because it gives the following error: Traceback (most recent call last): File "manage.py", line 12, in <module> execute_manager(settings) File "/usr/local/lib/python2.5/site-packages/django/core/management/__init__.py", line 340, in …

Member Avatar for Pupo
0
845
Member Avatar for Dembi

Hi All I have installed Python 2.6.2 When I use function of 'import Sybase,' I always received the following error: Traceback (most recent call last): File "export_alpha.py", line 3, in <module> import Sybase, sys ImportError: No module named Sybase Please gevi me your advice how I should correctly to add …

Member Avatar for msprayb
0
134
Member Avatar for sandorlev

Hello, I've been working on this self-made database. What do you think about it? What features should I create for it? I'd also like to get help in a select method, because I don't have the foggiest idea how it could be done. And what about making it a database …

0
239
Member Avatar for mahela007

Is there someway I can parse badly written HTML code in python? I want to get some info from a web page which uses HTML tables for it's formatting and I found numerous flaws in the code using w3cs validator. can I parse this code in python?

Member Avatar for mahela007
0
93
Member Avatar for explorepython

Hello all, After googling around for a few hours i can't find any example for passing arguments to an user-defined method in pyqt.. The only link i found related to this is [URL="http://www.commandprompt.com/community/pyqt/x1408"]http://www.commandprompt.com/community/pyqt/x1408[/URL] . In this example we have to make it to emit the signal and pass the argument.. …

Member Avatar for explorepython
0
1K
Member Avatar for Godflesh

Hello! I have more questions :) Is it possibe to create a "threadlock", "lock" if you use a file as a common resource? If you have a class that create data and put the data into a file and you have another class that will take data from the same …

Member Avatar for Gribouillis
0
98
Member Avatar for Godflesh

Hello i have a big problem, i want to import queue but i get this message, somehow it dont exist. Traceback (most recent call last): File "D:\Python26\test.py", line 9, in <module> import queue ImportError: No module named queue isnt that strange.

Member Avatar for Godflesh
0
16K
Member Avatar for Krstevski

I have created upload script and worked great, but I don't know how do I check the size of the file before upload because I want to limited on 10mb per file... So, mu question is: How do I check the size of the file before upload ? Thanks...

Member Avatar for Krstevski
0
99
Member Avatar for lewashby

I'M reading "Beginning Game Develpment with Python and Pygame". In the following code, I'M gettin this error in sysfont.py [COLOR="Red"]NameError: global name 'glob' is not defined[/COLOR] [CODE]import pygame from pygame.locals import * from sys import exit pygame.init() SCREEN_SIZE = (800, 600) screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32) font = pygame.font.SysFont("arial", 16) …

Member Avatar for Firewolf
0
840
Member Avatar for emir_gradacac

I have a folder with my game on Desktop. I've installed py2exe, 'cause it seemed to be a very good game and I wanted to share it. Now, I did everything right (i followed youtube tutorial), but when I start command prompt and typed 'a.py py2exe' it returned a message …

Member Avatar for Stefano Mtangoo
0
151
Member Avatar for gunbuster363

I want to use MySQLDB to connect MySQL but I got a problem. the problem is: --------------------------------------------------------------------------------- cs6201:/home/lamwaiman/python/data # python dm.py Traceback (most recent call last): File "dm.py", line 11, in <module> import MySQLdb File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in <module> File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module> File "build/bdist.linux-i686/egg/_mysql.py", line 6, …

Member Avatar for Stefano Mtangoo
0
381
Member Avatar for Godflesh

Hello again! I have a new question. I have run a script and wants to run it again with a "keypress" input from the user, how do i code that. Like this: import subprocess drive=input(" If you want to start the script again , press 1: ") if drive == …

Member Avatar for Godflesh
0
2K
Member Avatar for ivh90

hey all what is the best way to execute a certain function repeatedly after a certain period of time ? for example: the increment of a certain variable every second thx

Member Avatar for Namibnat
0
58
Member Avatar for El Duke

Hi, I am using Linux, and I was looking for free source code ( Python) for speech recognition, I found "Speech" for Windows. I have tried to run it on Linux, I got errors of missing modules, I found most of them online but when I got this error: [COLOR="Red"]No …

Member Avatar for El Duke
0
152
Member Avatar for butcher71793

i am making a game in python 2.3.5 and i wanted to know if there is a command that would make it so one sprite will move to another no matter what the position is on the screen.

Member Avatar for Firewolf
0
166
Member Avatar for charlottetemp

Hello. I am stuck on a simple piece of code. For some reason it keeps saying it can't call the Str object. Im also unsure on how to float the data to 2 decimal points (i don't know where the 2.f% should go.) The task is to make a taxi …

Member Avatar for charlottetemp
0
7K
Member Avatar for selimhanov

Hi, It must be a simple issue, but couldn't find any answer googling. Here is the problem: I have a simple test application with a TextCtrl, Button and StaticText. When I press the Button, it must query PostgreSQL with ...[code]SELECT name FROM contacts WHERE name LIKE '%"+TextCtrl.Value+"%'[/code] and return the …

Member Avatar for Pupo
0
153
Member Avatar for ewall

I've been working on a simple little PyGTK app that shows an icon in the system tray. When you right-click, the pop-up menu appears as expected. However, first the menu appears with just some up and down scroll arrows, and I have to scroll down before it fills in and …

Member Avatar for ewall
0
218
Member Avatar for gangster88

how could i print the length of a parameter?.. like def length(word) gives the output "word 4"?.. I have no clue of what to do? def length(): len=length()

Member Avatar for vegaseat
0
117
Member Avatar for punter999

[CODE]import wx class McaMenu(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640, 432)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document') file.AppendItem(new) file.AppendSeparator() open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document') file.AppendItem(open) save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save') file.AppendItem(save) save = …

Member Avatar for Namibnat
0
174
Member Avatar for gangster88

How could i index the program to output e.g. displayDate(10, 2, 2009) gives "10 Feb 2009" as the output. [code] def displayDate(day, month, year): Months = ['Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'August', 'Sept', 'October', 'December'] [/code]

Member Avatar for vegaseat
0
102
Member Avatar for kbalamuk

I have a string as such: str = 'C:\Process new\RF\test.dat' I need to replace all the backslashes with '/': res = 'C:/Process new/RF/test.dat' It is NOT a straight forward search and replace as I need to replace escape sequence (\). Any ideas?

Member Avatar for slate
0
10K
Member Avatar for personx121232

hi there,i have installed win32all package for python 2.5 , but now the python IDLE does not load any more...whats the problem,thanks.

Member Avatar for Stefano Mtangoo
0
88
Member Avatar for spogs

When I do the following: [code] s= serial.Serial('/dev/',9600) # or set a function and pass via command line s= serial.Serial(arg1,9600) [/code] The code executes without any error. [b]But[/b], when I use AJAX and POST the parameters to the script [code] def index(req): info = req.form sys.stderr = sys.stdout s= serial.Serial(info['device'],9600) …

Member Avatar for spogs
0
113

The End.