473,538 Members | 2,690 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.
4
16,399
thread by: google | last post Aug 30 '07 by: T
>>> 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\ \system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem' 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\ \system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem' What am I doing wrong? How do I change the value of an environment variable?
2
16,391
thread by: Michael Bendzick | last post Jul 18 '05 by: Alan Gauld
Is there a simple way in python to read a keyboard scan code? I'm working on a shell script that interfaces with a proprietary keyboard device (extra buttons) and need to be able to distinguish between those keys. Thank you
4
16,369
thread by: rotary | last post Jul 19 '05 by: Steve Holden
I have a variable that store a string (i.e. a variable name msg).I want to say something like that: if msg is empty ...then do something.So how can i figure that msg is empty string (no character, msg = '').Maybe a silly question but i have no programming experiense.Thanks, Leonidas
7
16,365
thread by: Nader Emami | last post Feb 26 '07 by: Paul Boddie
L.S., I have installed locally Python-2.4.4 without any problem. Then I would install the "ez_setup.py" to be able using of "easy_install" tool, but I get the next error: %python ez_setup.py Traceback (most recent call last): File "ez_setup.py", line 223, in ? main(sys.argv)
5
16,362
thread by: surreptitious | last post Jul 22 '08 by: kaarthikeyapreyan
Hello. I was wondering how to print all the files in a folder. If possible, could it be like Python prints one file and waits for a confirmation and then moves to the next? By the way, by print, I don't mean like printer paper stuff. I mean by Python writes the stuff out in the Command Prompt thing. My friend told me print in language doesn't mean...
5
16,361
thread by: WIdgeteye | last post May 24 '06 by: Tim Golden
I have been trying to run a python program and I get the following error: Traceback (most recent call last): File "<string>", line 39, in ? File "/home/Larry/.blender/scripts/bzflag/__init__.py", line 22, in ? import BZfileRead File "/home/Larry/.blender/scripts/bzflag/BZfileRead.py", line 24, in ? import BZsceneWriter File...
4
16,341
thread by: Benny the Guard | last post Jan 31 '08 by: elcron
Working on a class that I would use multiple constructors in C++ since I have different ways of creating the data. Tried this in python by defining multiple __init__ methods but to no avail, it seems to only find the second one. So I have: class myclass: __init__ (self, mystring1, mystring2) self.name = mystring1 ...
3
16,329
thread by: eugene | last post Jul 18 '05 by: Peter Hansen
I looked for a crc-16(crc 16) function to use but couln't find one that worked: This one is working .. def crc16(s): crcValue=0x0000
3
16,322
thread by: n o s p a m p l e a s e | last post Sep 5 '07 by: Wesley Brooks
Suppose I have a batch file called mybatch.bat and I want to run it from a python script. How can I call this batch file in python script? Thanx/NSP
3
16,313
thread by: coolindienc | last post Dec 7 '06 by: coolindienc
Hello guys, How would I control digits after decimal point? Andy
15
16,294
thread by: Reid Nichol | last post Jul 18 '05 by: Grant Edwards
Hello, I was wondering if I could control how many bytes are in an int and the byte order. In C/C++ I can use int32 but how do I do this in python? How can I control byte order?
4
16,285
thread by: Hamish | last post Dec 13 '07 by: MRAB
Hey I'm new to python, but I have used a fair bit of C and Perl I found Perls regex's to be very easy to use however I don't find Pythons regexes as good. All I am trying to do is detect if there is a number in a string. I am reading the string from an excel spread sheet using the xlrd
4
16,283
thread by: Anand Pillai | last post Jul 18 '05 by: Bengt Richter
Hi I am quite familiar with normal python errors which can be caught by using the try... except... finally clause. But very often I find other kinds of exceptions raised in my programs. Here is an example. <TRACEBACK> Traceback (most recent call last):
8
16,265
thread by: royG | last post Mar 24 '08 by: castironpi
hi i am trying to resize some images.First i'd read the size as a 2 tuple and then i want to divide it by 2 or 4 or 2.5 etc.. suppose origsz=(400,300) i want to divide the origsize by 2.5 so i can resize to (160,120) scale=2.5 how can i get the newsz?
2
16,256
thread by: robert | last post Sep 11 '07 by: Steve Holden
cPickle.loads raised "ValueError: insecure string pickle". The error is from a log file and I cannot reproduce it (quickly). What can be the cause for that error? Robert
7
16,249
thread by: Will Stuyvesant | last post Jul 18 '05 by: Asun Friere
Can you give a commandline example how to do XML Validation (checking against a DTD) with Python? Not with 4Suite or other 3rd party libraries, just the Python standard distribution. I have Python 2.2 but can upgrade to 2.3 beta if needed. I am looking for something like: " $ python validate.py myxmlfile.xml mydtd.dtd "
9
16,237
thread by: John Lull | last post Jul 18 '05 by: Mark Hammond
I'm writing a multithreaded COM server to manage a pool of hardware resources. All objects are designed to be thread-safe, and I've set sys.coinit_flags to COINIT_MULTITHREADED before importing pythoncom. The problem is that all requests to the server seem to be serialized by COM. To demonstrate the problem, I'm including a simple test...
2
16,206
thread by: John Reese | last post Dec 6 '05 by: Tim Peters
Hi. >>> import time, calendar, datetime >>> n= 1133893540.874922 >>> datetime.datetime.fromtimestamp(n) datetime.datetime(2005, 12, 6, 10, 25, 40, 874922) >>> lt= _ >>> datetime.datetime.utcfromtimestamp(n) datetime.datetime(2005, 12, 6, 18, 25, 40, 874922) >>> gmt= _
4
16,202
thread by: Kevin | last post Jul 18 '05 by: David Bolen
Has anyone else run into random IOErrors ( bad file descriptor) in multi-threaded Python apps? I've searched the newsgroups, and the only references I can find to that seem to be sporadically related to threading, but nobody seems to have a "fix" or even a clear understanding of what the issue is. The app I'm running into this with (once...
8
16,197
thread by: Nikhil | last post Jun 27 '08 by: bukzor
what are the simple ways? I could think of os.open(), os.exec(touch file) are there any simpler methods?
2
16,173
thread by: Sebastien de Menten | last post Jul 18 '05 by: Skip Montanaro
Hi, I need to output numbers to a csv file and use the new csv module in python2.3: " import csv data = ,] w = csv.writer(file("out.csv","w")) w.writerows(data)
6
16,128
thread by: alessandro | last post Jan 22 '07 by: Gabriel Genellina
Hi all, This is my framework for create TCP server listening forever on a port and supporting threads: import SocketServer port = 2222 ip = "192.168.0.4"
4
16,120
thread by: =?ISO-8859-7?B?1/H189zt6Ocgwfrt4eve?= | last post Jan 4 '07 by: itoakya
How can I convert a perl script to Python? Thank you!
9
16,114
thread by: Larry Hale | last post Jun 27 '08 by: Michael Torrie
I've heard tell of a Python binding for libmagic (file(1) *nixy command; see http://darwinsys.com/file/). Generally, has anybody built this and worked with it under Windows? The only thing I've been able to find is the python-magic module at http://hupp.org/adam/hg/python-magic/. Is this "THE" python-magic module. (It seems to be to...
1
16,103
thread by: Tom Jackson | last post Oct 15 '10 by: bvdet
I'm trying to make a game of "ghost", but I can't seem to check the dictionary file correctly to see if the word is located in it. How can I check to see if the variable created by the players is equal to a string in a list? The wordcheck function is what is not working. def load_words(): ''' Loads the words from 'words.txt' into a...

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.