Re: [Tutor] Running an exe from Python

2007-02-22 Thread Rikard Bosnjakovic
On 2/22/07, Nagendra Singh <[EMAIL PROTECTED]> wrote: > How can I get python to display > the results in the interactive window or what is the right way to do this. Use os.popen: http://docs.python.org/lib/os-newstreams.html#os-newstreams -- - Rikard. _

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Kirk Bailey
Mark Bystry wrote: > Ok. I'm not sure what programming language I want to try this in...since I'm > not sure how to write > this in any language (thought I'd give python a try. > > Here's my problem: I have a directory full of about 2,000 pdf files. I want > to be able to add the > same comm

Re: [Tutor] How many loops does "break" jump out of?

2007-02-22 Thread Bob Gailer
[EMAIL PROTECTED] wrote: > Am trying to convert a C program with a GOTO in it to Python and was > wondering > how many loops a Python "break" jumps out of. Here is the C pseudo code > > if (test_1) { > for (;;) { > if (test_2) { > do_stuff(); > } else if (test_2)

Re: [Tutor] how to determine where a module or function is called from

2007-02-22 Thread Lance Haig
Hi Kent, Thank you I was able to find it in the end. It was at the bottom of the file I was editing Lance Kent Johnson wrote: > Lance Haig wrote: >> I am debugging a script that was written by someone else and I was >> wondering if there is a way to determine where a function or module >

Re: [Tutor] how to determine where a module or function is called from

2007-02-22 Thread Kent Johnson
Lance Haig wrote: > I am debugging a script that was written by someone else and I was > wondering if there is a way to determine where a function or module is > imported from You can use the __file__ attribute of a module: In [9]: csv.__file__ Out[9]: '/Library/Frameworks/Python.framework/Vers

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Alan Gauld
"Mark Bystry" <[EMAIL PROTECTED]> wrote > Well that's awesome. Thanks for the code. Unfortunately > I cannot get it to run. After I installed the win32 extensions > for python... ISTR that before uing Windows scripting you have to enable it. There is a script in the library and a readme file tel

Re: [Tutor] what instance type is a function object?

2007-02-22 Thread Kent Johnson
Adam Pridgen wrote: > Thanks in advance for your help. > I am trying to pickle a class, but I want to exclude function objects > for obvious reasons. How do I determine if a python object is a > function, specifically when using isinstance()? I am not sure what a > type or instance a Python 'func

Re: [Tutor] how to determine where a module or function is called from

2007-02-22 Thread Alan Gauld
"Lance Haig" <[EMAIL PROTECTED]> wrote >I am debugging a script that was written by someone else and I was > wondering if there is a way to determine where a function or module > is > imported from >>> import time >>> print time >>> time.__file__ '/usr/lib/python2.4/lib-dynload/time.dll' >>> H

Re: [Tutor] How many loops does "break" jump out of?

2007-02-22 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > Am trying to convert a C program with a GOTO in it > to Python and was wondering how many loops a > Python "break" jumps out of. Just the immediately enclosing loop. You can fake higher level breaks by setting a global variable and immediately after the exit fro

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
Tim Golden wrote: > Slightly bizarrely, it works fine for me on a different > computer (my laptop). Both are Win2K. The only help I > could find on the error code suggested a permission issue, > which isn't likely. That said, I have experienced a few > funnies with the Python script writing the new

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
Mark Bystry wrote: > Well that's awesome. Thanks for the code. Unfortunately I cannot get it to > run. After I installed > the win32 extensions for python...I get this error when trying to run. > > Traceback (most recent call last): >File "C:\test.py", line 4, in > props.SummaryPropert

Re: [Tutor] DICOM Header

2007-02-22 Thread Andrew Liimatta
I have a directory that is filled with DICOM files that I obtained by using the Offis DICOM tool kit. The dictionary file I have is not included in the DICOM file. I have a flat file that has all of the DICOM fields defined as a python dictionary. In my initial post I included only the first s

[Tutor] how to determine where a module or function is called from

2007-02-22 Thread Lance Haig
I am debugging a script that was written by someone else and I was wondering if there is a way to determine where a function or module is imported from Thanks Lance ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
Well that's awesome. Thanks for the code. Unfortunately I cannot get it to run. After I installed the win32 extensions for python...I get this error when trying to run. Traceback (most recent call last): File "C:\test.py", line 4, in props.SummaryProperties.Category = "CAT69" File "C

Re: [Tutor] Running an exe from Python

2007-02-22 Thread Richard Querin
On 2/22/07, Nagendra Singh <[EMAIL PROTECTED]> wrote: What it does is that opens and closes the command window really fast and displays a value of 1 in the interpreter. How can I get python to display the results in the interactive window or what is the right way to do this. I assume you're

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
Mark Bystry wrote: > getting even closer. figure out how to write to a file but still in vbscript. > > dsofile_write.vbs > code: > Set objFile = CreateObject("DSOFile.OleDocumentProperties") > objFile.Open("D:\test.txt") > objFile.SummaryProperties.Category = "CAT54" > objFile.Save In Python, tha

Re: [Tutor] Running an exe from Python

2007-02-22 Thread Hugo González Monteverde
Hi, Take a lok=ok at the module named subprocess. You can catch the output of invoked programs with this. There is also a module called "commands" but it its not available in windows. Hugo ___ Tutor maillist - Tutor@python.org http://mail.python

Re: [Tutor] DICOM Header

2007-02-22 Thread Bill Sconce
On Thu, 22 Feb 2007 11:56:19 -0700 "Andrew Liimatta" <[EMAIL PROTECTED]> wrote: > > Hello, > > > I am having a hard time figuring something out. > > I have Files that are written in DICOM format. I want to be able > to pull out select elements from the header of these files > > I have a dict

[Tutor] what instance type is a function object?

2007-02-22 Thread Adam Pridgen
Thanks in advance for your help. I am trying to pickle a class, but I want to exclude function objects for obvious reasons. How do I determine if a python object is a function, specifically when using isinstance()? I am not sure what a type or instance a Python 'function' originates from. The be

Re: [Tutor] DICOM Header

2007-02-22 Thread wesley chun
> I have Files that are written in DICOM format. I want to be able to pull > out select elements from the header of these files for those who aren't in the industry, DICOM files are a digital imaging format typically used by the medical industry. it contains an embedded JPG and lots of patient/

[Tutor] Running an exe from Python

2007-02-22 Thread Nagendra Singh
Hi, I am trying to learn Python and have no prior programming experience. My problem is that I am trying to call an .exe through Python, the exe gives certain information about a file when I simply type it at the command prompt, something like C:> getinfo C:\Singh\abc.bcd and it displays the in

[Tutor] DICOM Header

2007-02-22 Thread Andrew Liimatta
Hello, I am having a hard time figuring something out. I have Files that are written in DICOM format. I want to be able to pull out select elements from the header of these files I have a dictionary file that contains enteries like this. dicomdict = { # meta tags (0x0002,0x0001):('OB', "Fil

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
getting even closer. figure out how to write to a file but still in vbscript. dsofile_write.vbs code: Set objFile = CreateObject("DSOFile.OleDocumentProperties") objFile.Open("D:\test.txt") objFile.SummaryProperties.Category = "CAT54" objFile.Save Mark Mark Bystry wrote the following on 2/22/200

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
I think I'm getting close but with the wrong programming language... filename: test.vbs code: Set objFile = CreateObject("DSOFile.OleDocumentProperties") objFile.Open("C:\test.txt") Wscript.Echo "Category: " & objFile.SummaryProperties.Category With the help of dsofile.dll the above reads the "Ca

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
Actually no. I want to change the Windows metadata. This is the same metadata that is on all files. It isn't PDF specific. (I wonder if Linux is the same) Basically, I can select 100's of file in a dir, right-click, properties, summary, and add something to the Category field. This obviously a

[Tutor] How many loops does "break" jump out of?

2007-02-22 Thread etrade . griffiths
Am trying to convert a C program with a GOTO in it to Python and was wondering how many loops a Python "break" jumps out of. Here is the C pseudo code if (test_1) { for (;;) { if (test_2) { do_stuff(); } else if (test_2) { for (ip=m1+m2+1;ip<=m;ip++) {

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
> Here's my problem: I have a directory full of about 2,000 pdf files. I want > to be able to add the > same comment to the "Category" field of each file (in the document properties > of the file). So I am > looking to batch process pdf files (or any filetype, i guess) to add some > metadata.

[Tutor] Add metadata to a dir of files.

2007-02-22 Thread Mark Bystry
Ok. I'm not sure what programming language I want to try this in...since I'm not sure how to write this in any language (thought I'd give python a try. Here's my problem: I have a directory full of about 2,000 pdf files. I want to be able to add the same comment to the "Category" field of each

Re: [Tutor] storing text in databases

2007-02-22 Thread Che M
Thank you Bob and Alan. That helps alot. I will store text as files and index them somehow in the database (and yes Alan's section on SQL on his site is a great resource for this). -Che _ The average US Credit Score is 675. The cos

Re: [Tutor] Explanation of this lambda

2007-02-22 Thread Johan Geldenhuys
Thanks, Alan. That makes it a lot easier to understand. I'll play around with other examples to see what it is doing. Johan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gauld Sent: 22 February 2007 11:46 AM To: tutor@python.org Subject: Re: [Tut

Re: [Tutor] storing text in databases

2007-02-22 Thread Alan Gauld
"Chae M" <[EMAIL PROTECTED]> wrote > Is it a reasonable idea to store text (a few hundred words each > record) in a database? That depends on what you want to do with it. If you only wanmt to store the data and maybe do some searches for words etc then no, a simply folder fiull of text files will

Re: [Tutor] Explanation of this lambda

2007-02-22 Thread Alan Gauld
"Johan Geldenhuys" <[EMAIL PROTECTED]> wrote > Would somebody care to explain what is happening in this process? > > def intToBin(self, x, count=8): >return "".join(map(lambda y:str((x>>y)&1), > range(count-1, -1, -1))) "".join() turns a list into a string map() returns a list where e