15,181 Topics

Member Avatar for
Member Avatar for personx1212

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 …

Member Avatar for personx1212
0
116
Member Avatar for Malinka

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. …

Member Avatar for Gribouillis
0
9K
Member Avatar for nuaris

[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 …

Member Avatar for yinchao
0
2K
Member Avatar for yari

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 …

Member Avatar for yari
0
2K
Member Avatar for Kraln00b

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 …

Member Avatar for Kraln00b
0
159
Member Avatar for hisan
Member Avatar for Gribouillis
0
7K
Member Avatar for lionaneesh

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] = …

Member Avatar for TrustyTony
0
792
Member Avatar for bettersaid

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 …

Member Avatar for bettersaid
0
164
Member Avatar for bettersaid

[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': …

Member Avatar for TrustyTony
0
188
Member Avatar for skumar244

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 …

Member Avatar for TrustyTony
0
95
Member Avatar for wezelball

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 …

Member Avatar for griswolf
0
125
Member Avatar for krishna_sun82

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" …

Member Avatar for krishna_sun82
1
1K
Member Avatar for Hawkpath

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 …

Member Avatar for Gribouillis
0
137
Member Avatar for sial_m

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, …

Member Avatar for Gribouillis
0
351
Member Avatar for zyrus001

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. …

Member Avatar for griswolf
0
315
Member Avatar for cleve23

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]

0
81
Member Avatar for Peter_TARAS

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 …

Member Avatar for vegaseat
0
17K
Member Avatar for Archenemie

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 …

Member Avatar for Archenemie
0
113
Member Avatar for Tcll

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 …

Member Avatar for Tcll
0
102
Member Avatar for jrcagle

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 …

Member Avatar for pythonista
0
138
Member Avatar for technocratic

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 …

Member Avatar for technocratic
0
2K
Member Avatar for student_

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 …

Member Avatar for student_
0
80
Member Avatar for technocratic

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 …

Member Avatar for vegaseat
0
5K
Member Avatar for matto.g1456

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 …

Member Avatar for matto.g1456
0
80
Member Avatar for lewashby

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.

Member Avatar for vegaseat
0
2K
Member Avatar for timrichardson

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, …

Member Avatar for timrichardson
0
357
Member Avatar for WildBamaBoy

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 …

Member Avatar for WildBamaBoy
0
114
Member Avatar for Fluffybunny

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, …

Member Avatar for TrustyTony
0
2K
Member Avatar for sanv

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 …

Member Avatar for woooee
0
129
Member Avatar for hisan

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 …

0
59

The End.