473,545 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Forum

Python programming language - Ask questions about python interpreter, control flow, data structures, modules errors, classes, standard library, gui, databases, unit testing, object oriented, structured programming and more.
9
19,061
thread by: sdb1031 | last post Dec 6 '05 by: rbt
I am trying to run an exe within a python script, but I'm having trouble with spaces in the directory name. The following example will display the usage statement of the program, so I know that the space in the path to the exe is being handled correctly and that the program was executed. CMD= r'"C:\program files\some...
3
19,045
thread by: David Eppstein | last post Jul 18 '05 by: David Eppstein
Why doesn't this work? >>> import math >>> math.exp(1j*math.pi) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: can't convert complex to float; use e.g. abs(z) The expected answer, of course, is -1.
2
19,004
thread by: kbass | last post Jul 18 '05 by: Graham Fawcett
I would like to remove file that are older than 7 days old from a directory. I can do this in shell script rather easy but I would like to integrate this functionality into my Python program. How can this be achieved? Which module can be used to perform this tasks? Thanks! Shell Script example: find /path/to/dir -mtime +30 -exec rm '{}' \;...
6
18,999
thread by: Robin Haswell | last post Feb 22 '06 by: Magnus Lycka
Hey guys I was wondering if you could give me a hand with something. If I have two tuples that define a range, eg: (10, 20), (15, 30), I need to determine whether the ranges overlap each other. The algo needs to catch: (10, 20) (15, 25) (15, 25) (10, 20) (10, 25) (15, 20) and
4
18,992
thread by: hagai26 | last post Oct 18 '05 by: hagai26
I have a hebrew text file, which I want to read in python I don't know which encoding I need to use & how I do that thanks, hagai
12
18,969
thread by: Paul Sijben | last post Jan 12 '07 by: Ganesan Rajagopal
I have a server in Python 2.5 that generates a lot of threads. It is running on a linux server (Fedora Core 6). The server quickly runs out of threads. I am seeing the following error. File "/home/sijben/ORCA/src/libmercury_mt.py", line 565, in __init__ MercuryObject.__init__(self,mylink) File "/home/sijben/ORCA/src/libmercury_mt.py",...
3
18,956
thread by: nicolasg | last post Jun 18 '06 by: hdante
Hi, I'm trying to open a file (any file) in binary mode and save it inside a new text file. After that I want to read the source from the text file and save it back to the disk with its original form. The problem is tha the binary source that I extract from the text file seems to be diferent from the source I saved. Here is my code: 1)...
2
18,923
thread by: Anne Finch | last post Nov 7 '10 by: Anne Finch
I am having issues creating a menu-driven program that should accept integers and calculate the mean and median values and display them. I'm not having trouble calculating the Mean or Median, but I am having trouble with configuring the list into the program. #Main def main(): array = #this would be the list, but what do i do with it?...
5
18,901
thread by: Ben Sizer | last post Jun 25 '07 by: Justin Ezequiel
I need to copy directories from one place to another, but it needs to overwrite individual files and directories rather than just exiting if a destination file already exists. Previous suggestions have focused on looking at the source for copytree, but it has several places where exceptions can be raised, and the documentation for the shutil...
3
18,885
thread by: eight02645999 | last post Feb 17 '06 by: Marius Gedminas
hi how can i get the number of days since epoch using the time module? or do i have to manually do the arithmetic? thanks
2
18,875
thread by: Caleb Hattingh | last post Mar 31 '06 by: Caleb Hattingh
Hi I tried several Google searches to no avail. I read through pretty much most of the online docs at the matplotlib sourceforge site, but didn't find what I was looking for. I went through the axis.py and ticker.py code today, trying to find out how to set the number of points (ticks) on an axis in Matplotlib. I know that something...
5
18,866
thread by: omission9 | last post Jul 18 '05 by: Peter Hansen
I have a text file which contains the occasional non-ascii charcter. What is the best way to remove all of these in python?
12
18,862
thread by: Jerry Sievers | last post Jul 18 '05 by: Mustafa Demirhan
Greetings Pythonists; I have limited experience with threaded apps and plenty with old style forked heavyweight multi-processing apps. Using Python 2.3.3 on a Redhat 7.x machine. Wondering if there is a simple way from a main python program to kill a running thread? I see with the 'threading' module the way daemonic threads behave...
9
18,859
thread by: k04jg02 | last post Dec 10 '06 by: Paul Boddie
I want to make a Python app that runs in the background, and when a user hits a key combination, for a function to run. This sounds simple enough, but all of the keypress detecting libraries I can find count on you creating a window and then detecting keypresses while that window has focus. I want my function to execute when the user presses...
1
18,855
thread by: many_years_after | last post Nov 25 '06 by: Rob Williscroft
class mythread(threading.Thread): def __init__(self, threadname): threading.Thread.__init__(self, name = threadname) def run(self): print 'i am running' print 'i quit run()' thread = mythread('1') thread.start()
20
18,848
thread by: Ramdas | last post Jan 10 '07 by: Lawrence D'Oliveiro
How do I add users using Python scripts on a Linux machine? Someone has a script?
1
18,846
thread by: vertigo | last post Dec 10 '06 by: Jonathan Curran
Hello How to create table with string variables ? I tried import string X = zeros(, string) (i used Numeric.Float earlier, but now can't find string class anywhere)
220
18,828
thread by: Brandon J. Van Every | last post Jul 18 '05 by: Christian Tismer
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it...
13
18,775
thread by: Fazer | last post Jul 18 '05 by: Fazer
Hello, Can anyone point me to a way on how to send a SMS message using Python? Thanks,
3
18,774
thread by: Joe | last post Jul 21 '05 by: Joe
I have the executable of a script that I wrote, that has been erased. Is there any way to retrieve the uncompiled python script from the executable that was created with py2exe? Thank you, Joe
8
18,773
thread by: Neil Isaac | last post Apr 20 '06 by: Philippe Martin
I have been writing python my little python scripts in gedit and running them using the command line. At this point I'm thinking that I would like to start using a real IDE. I don't need anything special or fancy, but would like it to manage projects, etc... I do know about kdevelop and emacs/vi(m)/nano/pico, but I use gnome most of the time...
5
18,753
thread by: dmitrey | last post Jun 27 '08 by: castironpi
hi all, could you inform how to print binary number? I.e. something like print '%b' % my_number it would be nice would it print exactly 8 binary digits (0-1, with possible start from 0) Thank you in advance, D
5
18,724
thread by: newmaid | last post Feb 29 '08 by: bvdet
hi all.. if i had a csv file that had data in the format: 1, male, 1997 2, male, 2000 3, female , 1977 etc how would i pull all 3 columns out of the csv into lists
8
18,722
thread by: johnlichtenstein | last post Jun 11 '06 by: mjp
I am using cx_Oracle and MySQLdb to pull a lot of data from some tables and I find that the cursor.execute method uses a lot of memory that never gets garbage collected. Using fetchmany instead of fetchall does not seem to make any difference, since it's the execute that uses memory. Breaking the query down to build lots of small tables...
4
18,707
thread by: abcd | last post Jan 8 '07 by: Gabriel Genellina
I am using fnmatch.fnmatch to find some files. The only problem I have is that it only takes one pattern...so if I want to search using multiple patterns I have to do something like.... patterns = for p in patterns: if fnmatch.fnmatch(some_file_name, p): return True

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.