15,181 Topics
| |
Hello there, i have this problem when i try to combine a variable file name that is in languages other than English with a path, like this : path = 'C:\\Files\' path+=UnicodeName+'.txt' it gives the following error : UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 7: ordinal not … | |
Hello everybody! I have to go through each subfolder and extract matching strings from each of the files (File_1, File_2, File_3, File_4, etc.). Unfortunately, I don't know how to do that under Linux. I have the following structure: MainFolder: ---Subfolder A ------File_1 ------File_2 ------File_3 ---Subfolder B ------File_4 ------File_5 ------File_6 ---Etc. … | |
[ICODE]class classA: #saved as classA.py def __init__(self): print "class A" printB() def printB(): print "B"[/ICODE] [ICODE]>>> classA() class A Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> classA() File "C:\Documents and Settings\Owner\Desktop\timetable\classA.py", line 5, in __init__ printB() NameError: global name 'printB' is not defined[/ICODE] Using the class … | |
Hi, I've been trying to make a poker game, i got the basic things running like giving the cards to the player and dealer, but i am having trouble coming up with a way to compare the 2 hands... I'm new to python, i tried different ways and didn't really … | |
Hello, I could use a spot of help today. I am very new to python (n00b) and I have a rather specific Issue I am trying to resolve. This problem can be solved using ArcGIS (for those who know it) I simply desire to know more about python so I … | |
Is there way to get the graphics card details in python. please help me in achieving this | |
I am trying to solve the problem Present at [url]http://www.codechef.com/problems/INTEST/[/url] I have made a small Python script to do my job :- [CODE]array = [] no_lines = 0 no = 0 j=0 div_no=0 no_lines = input() no = input() temp = no_lines while(no_lines>0) : i=0 i = input() array[j] = … | |
help! dunno how to convert this in python.. 'contains == ???' in python [CODE]if (basket contains "fruits") then try tell application "Document" to tell application "System Events" to tell application process "Document" to click button "Cancel" of sheet 1 of window "Untitled" tell application "Document" to quit saving no end … | |
[CODE]from Tkinter import * class ButtonHandler: def __init__(self): self.root = Tk() self.root.geometry('600x500+200+200') self.label = Label(self.root, text=str(self.mousedown)) self.can = Canvas(self.root, width='500', height='400', bg='white') self.can.bind("<Motion>",lambda x:self.handler(x,'motion')) self.can.bind("<Button-1>",lambda x:self.handler(x,'press')) self.can.bind("<ButtonRelease-1>",lambda x:self.handler(x,'release')) self.label.pack() self.can.pack() self.root.mainloop() def mouseDown(self, event ): return 1 def handler(self,event,x): if x == 'press': self.mousedown = 1 elif x == 'release': … | |
I am pretty new to the Jython world, I have a need to create the jvm custom properties but i am king on struck at array. please provide expertise suggestion.. Here is my code snippet : ### JVM CUSTOM PROPERTIES SCRIPT ### fileOpen = open("/tmp/jvmname.props", "r") fileRead = fileOpen.read() server … | |
Hi, I can send commands to my TRENDnet TV-IP410 camera using wget as follows: [CODE] wget --user=user --password=password http://192.168.1.140/cgi/admin/ptctrl.cgi?action=move\&Cmd=down [/CODE] This would send the "down" command to tilt the camera. There are also "left", "right", etc. commands What is the best way to do this in python? I could use … | |
Hello everyone, I am getting ImportError when I tried to do pure embedding and call Python function from C. The Python code is named dummy.py given by: [CODE=python] def multiply(x, y): print x, y z = x * y return z; [/CODE] It is called by the c program "calldummy.c" … | |
Hello all, I'm taking a programming course in python and I have to write a program using certain math functions like pow() and sqrt() and I don't know what to program. Please give me some ideas on programs. I don't need to know how to program them, just what to … | |
Hello all, I have python 2.6 installed, i can see it in /usr/bin and I can run it in terminal. I cannot however seem to figure out how to open the Idle, or get the program to show in the redhat drop menu. Kinda new to linux (some ubuntu use, … | |
I'm looking to write a program that should be capable of holding around 1000 records, each record will contain a varying number of fields and values. Usually, I'd create a list of dictionaries for something like this but wanted to know if that's the right way to go about it. … | |
I want to display out text in my panel inside a for loop,but when i use wx.StaticText. It will overwrite the previous sentence. How can i solve this problem??? [CODE]for item in ErrorStorage: print item wx.StaticText(self.p1, -1, item)[/CODE] | |
Hi! I designed a class in Python to do stuffs related to genetic algorithms. I have a method in this class, which should provide a sort of log to keep the track of the populations during the evolution. I mean, I provide the filename as a string argument to this … | |
Hi, id like to set values for a botton is wxpython by taking that value from a text file. For this code [CODE]button = wx.Button(parent, label = “x”)[/CODE] and for example on the 1st line of the text file id like to read x. Ive played about with this a … | |
I need help counting the number of times a particular number is used in a text file... and to output a number of results to a text file... eg: [B](input.txt):[/B] 01 40 39 01 72 39 36 56 72 82 39 ### 56 62 38 03 03 06 38 30 … | |
So I was thinking that there would be a simple Pythonic way to delete a directory structure. My app creates and deletes user accounts, which may contain any number of subdirectories and files. Hence, I wanted to do something like: [code] os.rmdir(user_directory) [/code] BUT...that throws an error when user_directory is … | |
I have a Python command line program I am attempting to convert into a GUI. Before I bury myself in code does anyone have some advice on this process? Is there a method to simply make everything in the CLI program show up in a tkinter frame? For inputs I … | |
I am a student about 4 weeks into learning python, so i do not know a lot, and am hoping someone can help me understand what i am doing wrong, here is the code: [code=python] def main(): name = "TEST" age = 50 makename() makeage() print "You are" ,age ,"years … | |
Hello, I'm playing around with some Python and tKinter and have been wrestling with the idea of an on-screen keyboard that outputs keys-pressed to a text field. I'm familiar with calculators and button input, but would anyone have some thoughts on designing an on-screen keyboard? I'm thinking that I will … | |
Any ideas on how one would force inno to include folders without extracting the data to the program folder, in other words I have support data for my pygame in various folders, the exe I made works fine but when I install the .exe inno takes all the data out … | |
Could someone please tell me why this code will not close my app when the [X] at top right corner is clicked? [CODE]def shutdown(): track.stop() app.destroy() app.protocol("WM_DELETE_WINDOW", shutdown)[/CODE] If you want to see the whole code it's on an earlier post called "Tkinter Scale". Thanks. | |
The python module python-gdata includes an pretty comprehensive example of using python to fetch google calendar events (calenderEvents.py) No matter what I do, I only get 25 events returned. This is the default value of the maximum number of records returned. The example script includes these comments [code] In reality, … | |
In this program I have a lot of game directories in a list like so: [CODE]base = "C:/Program Files/Game" expansion = "C:/Program Files/Game/Expansion" Games = [(base, "Base Game"),(expansion, "Expansion 1")] Installed = [][/CODE] The program then sees if they are installed like this: [CODE]for path, name in Games: #For every … | |
Hi I am sending a text file to a remote app using urllib2. It all works well, but it just seems to take a very long time to send the data. My code is basically doing : TxData = open('OutputFile.txt') data = {'name': 'value', 'file': TxData } f = urllib2.urlopen(url, … | |
Hi, I have written a script that checks whether a line has been added to a file. Whenever, a line gets added to the file a thread is created to process that line. And if a certain conditions holds for that read line, the thread should sleep for 1h and … | |
I need to get the info available devices in my LAN network. My logic is as follows: 1.Send a UDP packet/s to the IP 255.255.255.255 and wait for the response from the available devices, once the devices repond back need to analyze the response.. Please help me out in implementing … |
The End.