473,544 Members | 1,924 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.
1
10,993
thread by: Valentine Kouznetsov | last post Jul 18 '05 by: Rob Williscroft
Hi, simple question, how to execute command in current shell, not in subshell? Example. I have environment variable A=aaa and need to invoke shell (sh) script which will do something with A. If I do os.system() then sub-shell will setup A and execute my script there leaving A in parent shell untouched. Thanks,
0
1,178
thread by: Ken Godee | last post Jul 18 '05 by: Ken Godee
I have a python program I need to interface with an api. The api is native C but they also have a perl wrapper. I'm thinking along the lines of "pyperl" or perhaps pyInline. I don't feel astute enough in C to create my own wrappers.
5
2,245
thread by: Gary | last post Jul 18 '05 by: Alex Martelli
Hi- I've been searching the web for a while and I've been unable to find a way to access c data objects in python without using SWIG. I can do methods just fine but I can't access variables. It seems like PyModule_AddObject should work but it segfaults my program. There's a good chance I'm just using it wrong, or I should be using...
3
5,323
thread by: Dan Williams | last post Jul 18 '05 by: Alex Martelli
Python experts, Is there a more pythonic way to do something evquilent to what this line does without creating a dummy class? self.file = type("", (object,), {'close':lambda slf: None})() As you can guess, I want a dummy object that I can call close on with impunity.
9
12,224
thread by: Robin Cull | last post Jul 18 '05 by: Sean Ross
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after them. What I want to do is filter out a subset of this dict to produce another dict that satisfies a set of criteria (in this case whether it...
1
8,230
thread by: A | last post Jul 18 '05 by: Alan Kennedy
Hi, Does anyone have any experience with Optical Character Recognition in Python? I would like to automatically register emails with a free emails provider e.g. Yahoo or Hotmail. The problem is that, for a successful registration, I must fill in characters shown in a picture. So I need to recognize the characters in a picture. Any idea how?...
16
2,688
thread by: Gonçalo Rodrigues | last post Jul 18 '05 by: Gonçalo Rodrigues
Hi, Consider the following class: >>> class Test(object): .... def __init__(self, obj): .... self.__obj = obj .... def __getattr__(self, name): .... return getattr(self.__obj, name) ....
1
2,470
thread by: BlackHawke | last post Jul 18 '05 by: Christian Tismer
Hello! My name is Nick Soutter, I am the owner of a small game company in San Diego, CA called Aepox Games (www.aepoxgames.net). Our first product, Andromeda Online (www.andromedaonline.net), goes
6
2,397
thread by: Chris Gonnerman | last post Jul 18 '05 by: Thomas Heller
I'll be quick. Here's a transcript: C:\usr\WConio-1.5>python setup.py build --compiler=mingw32 running build running build_py running build_ext building '_WConio' extension writing build\temp.win32-2.3\Release\_WConio.def C:\MINGW32\BIN\dllwrap.exe -mno-cygwin -mdll -static --output-lib build\temp.win
8
3,441
thread by: Jean-Pierre Andreaux | last post Jul 18 '05 by: Alex Martelli
Gmpy module was a wrapper of the GNU MP library. It seems that no evolution is done on this module since 2001. Indeed, Gmpy is not supported in Python 2.2 nor 2.3. My question is the following: what is the better replacement solution for manipulating long numbers. I want to do long numbers exponentiations. Thanks in advance for your...
2
1,904
thread by: Chris Wright | last post Jul 18 '05 by: Chris Wright
Is there a way to go from the AST output of compiler.paser to byte code i.e. in the example below, is there a way to compile m and get a code object that could then be called? cheers and thanks for the help chris wright
0
1,897
thread by: Quinet, Joel | last post Jul 18 '05 by: Quinet, Joel
Hi all, I use the Win32 extension (Build 157) module with Python 2.3 to add row in a sql server 2000 sp3 DB. My problem is I can not insert data of type money in the DB. I use the following command to create the parameter : prm = cmd.CreateParameter('Open', constants.adCurrency, constants.adParamInput, 8, 12.10)...
2
17,637
thread by: x-herbert | last post Jul 18 '05 by: x-herbert
Hi, I have a small test to "compile" al litle script as a WMI-Tester. The script include a wmi-wrapper and "insert" the Win32-modeles. here the code: my "WMI-Tester.py" ----- import wmi
9
2,333
thread by: Syver Enstad | last post Jul 18 '05 by: Syver Enstad
I've downloaded both source distro, and binary installer. Installed python with the binary installer, when I attempted to compile mxDateTime (mxBase) for 2.3 with MSVC 6.0 I got an error that seemed related to forward declarations. It seems that the #defines that makes staticforward into extern when using the MSVC 6 compiler has been...
8
2,950
thread by: Ronald Legere | last post Jul 18 '05 by: Ng Pheng Siong
The new itertools stuff is pretty cool. One thing that bothers me though is that there seems to be no way to copy an iterator. How does one work around this? Is there a trick that I am missing? Without being able to 'split' an iterator, I can't think of how to do some of the cool things you can do with lazy lists in Haskell. It seems...
1
1,799
thread by: Mark Carter | last post Jul 18 '05 by: Cliff Wells
Running xrced.py produced: Traceback (most recent call last): File "C:\Python23\Lib\site-packages\wxPython\tools\XRCed\xrced.py", line 28, in ? from tree import * # imports xxx which imports params File "C:\Python23\Lib\site-packages\wxPython\tools\XRCed\tree.py", line 1174 ^ SyntaxError: invalid syntax ---
1
2,239
thread by: Clarence Gardner | last post Jul 18 '05 by: Clarence Gardner
I must not be getting the point of this from the documentation. I want to connect to a URL and see what it redirects to. I built a redirect handler that does nothing much (for testing) and installed it thusly: import urllib2 class R(urllib2.HTTPRedirectHandler): def redirect_request(req,fp,code,msg,hdrs): print "%s, %s, %s, %s, %s" %...
2
1,325
thread by: Craig Zoretich | last post Jul 18 '05 by: Craig Zoretich
Hi, Is it possible to change how the "def" builtin command works? Specifically I want to modify def to write to a log file when a function executes (for instance the name of the function, when it was executed - that sort of thing). I want to avoid having to put some code in each and every function I write to do this logging for me. ...
1
4,765
thread by: nushin | last post Jul 18 '05 by: nushin
If you do not null out the output of your parent process that launches a child process by os.spawnv( ) in P_NOWAIT mode, you will see that your child process is launched *synchronously* instead of asynchronously. This is a bug! Here's a code sample: In your parent.py file, call child.py as ...
3
10,804
thread by: nushin | last post Jul 18 '05 by: nushin
Try to launch a test program that prints hello world for a minute or so using, spawnv( ) or spawnl( ). Check to see the process state code that the program is running. I am using RedHat Linux 7.3 and Python 2.2.2 and i see that the program is either launched as Zombie state using spawnv(), or running in State "S" sleep in spawnl( ). Here's...
7
2,569
thread by: Eric van Riet Paap | last post Jul 18 '05 by: John Machin
Hi, On python2.1.3, python2.2.1 and python2.2.3 round(22.47,2) gives 22.469999999999999 . Does anyone know if this is a bug or some weird, yet unexpected, behaviour? P.S. I haven't tested python2.3, but python1.5.2 doesn't have this problem.
2
1,447
thread by: the_rev_dharma_roadkill | last post Jul 18 '05 by: the_rev_dharma_roadkill
Hi, I'm a Python newbie, but I have some experience in other languages. I need to create about 100,000 instances of one class. Each instance has two lists, one usually empty, the other containing exactly 200 elements which differ widely between the 100,000 instances, but about half of the elements in these lists will be empty strings: ...
1
1,683
thread by: Rim | last post Jul 18 '05 by: David Goodger
Hi, I've installed the latest docutils, but I can't find where the tools have been installed. I can see them when I expand the tarball, but I can't find them under site-packages. Thanks -Rim
12
5,203
thread by: Alessandro Crugnola *sephiroth* | last post Jul 18 '05 by: Thomas Heller
Hi, i'm trying to compile a .py script using py2exe into a win .exe file. In that script i'm using xml.dom.minidom to parse an xml file (with the iso8859-1 encoding) i've included in the setup command line the --packages encodings but once i launch the exe file i receive this error in the console window: Traceback (most recent call last):...
9
13,670
thread by: Edilmar | last post Jul 18 '05 by: Fredrik Lundh
Hi, First of all, I'm new in Python... I have worked with manu langs and IDEs, like Delphi, VB, JBuilder, Eclipse, Borland C++, Perl, etc... Then, today I think IDEs like Delphi have a excelent environment to develop apps with little time. I saw many people talking about Python like a easy lang to learn and to develop. But I have look...

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.