Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread Surya K



Date: Mon, 19 Mar 2012 19:11:18 -0400
From: bgai...@gmail.com
To: sur...@live.com
CC: tutor@python.org
Subject: Re: [Tutor] Unable to open .py files directly


  



  
  
On 3/19/2012 10:30 AM, Surya K wrote:

  
  
Hi there,



I am facing a typical problem in opening .py files by
  clicking them (In windows).
  



In addition to the other advice - 



"open" is ambiguous. What do you want to happen? Edit or execute?



clicking a file usually just selects it. Do you mean double-click or
what?



The more precise you are regarding what you want and what you do
makes it a lot easier for us to help.

-- 
Bob Gailer
919-636-4239
Chapel Hill NC

I was "double clicking".. and I want to open IDLE.  
  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread Bod Soutar
On Mar 21, 2012 1:03 PM, "Surya K"  wrote:
>
>
>
> 
> Date: Mon, 19 Mar 2012 19:11:18 -0400
> From: bgai...@gmail.com
> To: sur...@live.com
> CC: tutor@python.org
> Subject: Re: [Tutor] Unable to open .py files directly
>
>
> On 3/19/2012 10:30 AM, Surya K wrote:
>>
>> Hi there,
>>
>> I am facing a typical problem in opening .py files by clicking them (In
windows).
>
>
> In addition to the other advice -
>
> "open" is ambiguous. What do you want to happen? Edit or execute?
>
> clicking a file usually just selects it. Do you mean double-click or what?
>
> The more precise you are regarding what you want and what you do makes it
a lot easier for us to help.
>
> --
> Bob Gailer
> 919-636-4239
> Chapel Hill NC
>
>
>
> I was "double clicking".. and I want to open IDLE.
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

In that case, you need to change the file association of .py files to IDLE

Bodsda
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread Surya K



Date: Wed, 21 Mar 2012 13:29:17 +
Subject: Re: [Tutor] Unable to open .py files directly
From: bod...@googlemail.com
To: sur...@live.com
CC: tutor@python.org; bgai...@gmail.com



On Mar 21, 2012 1:03 PM, "Surya K"  wrote:

>

>

>

> 

> Date: Mon, 19 Mar 2012 19:11:18 -0400

> From: bgai...@gmail.com

> To: sur...@live.com

> CC: tutor@python.org

> Subject: Re: [Tutor] Unable to open .py files directly

>

>

> On 3/19/2012 10:30 AM, Surya K wrote:

>>

>> Hi there,

>>

>> I am facing a typical problem in opening .py files by clicking them (In 
>> windows).

>

>

> In addition to the other advice - 

>

> "open" is ambiguous. What do you want to happen? Edit or execute?

>

> clicking a file usually just selects it. Do you mean double-click or what?

>

> The more precise you are regarding what you want and what you do makes it a 
> lot easier for us to help.

>

> -- 

> Bob Gailer

> 919-636-4239

> Chapel Hill NC

>

>

>

> I was "double clicking".. and I want to open IDLE.

>

>

> ___

> Tutor maillist  -  Tutor@python.org

> To unsubscribe or change subscription options:

> http://mail.python.org/mailman/listinfo/tutor

>
In that case, you need to change the file association of .py files to IDLE 
Bodsda 


Yeah, I tried that. The worst part is we don't have any exe file specifically 
for IDLE. I mean windows has to choose whether to edit or compile.
In my case, the file associated with my .py files is python.exe 
(c:/python27/python.exe). I still don't understand why its not opening in IDLE. 

If I am wrong, is there any special application (exe file) for IDLE so that I 
can configure to??
  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread bob gailer

On 3/21/2012 9:00 AM, Surya K wrote:

I was "double clicking".. and I want to open IDLE.

Great. Better explanation.

To make it even better I will now assume you want the file to be opened 
by IDLE in a script (edit) window.


So an even better explanation is "when I double-click the file I want it 
to be opened by IDLE in a script (edit) window."


On the other hand if I take what you say literally all you want to do is 
open IDLE. This is probably not the case.


Again I say it is well worth the effort to be as thorough and explicit 
as possible.


So that we can reproduce the behavior you want.

--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread bob gailer

On 3/21/2012 10:42 AM, Surya K wrote:

>
In that case, you need to change the file association of .py files to 
IDLE

Bodsda



Yeah, I tried that. The worst part is we don't have any exe file 
specifically for IDLE. I mean windows has to choose whether to edit or 
compile.



In my case, the file associated with my .py files is python.exe 
(c:/python27/python.exe). I still don't understand why its not opening 
in IDLE.

Try right-clicking the file. You will should geta  "context menu"

Do you see Edit with IDLE? If so, choose that.

Also take a look at the Advanced settings for the file type .py On my 
windows 2003 server in the Explorer I click Tools -> Folder Options -> 
File Types, select .py then click Advanced. Here I see

Edit with IDLE
I select that and click Edit and see
"D:\Python27\pythonw.exe" "D:\Python27\Lib\idlelib\idle.pyw" -e "%1"
in your case that should read
"C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"
If you don't have an Edit with IDLE entry, click New and add one.
If you want that to be the double-click behavior click Set Default.

If your OS is different the route to the file associations may be different.

--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] feedback on writing pipelines in python

2012-03-21 Thread Abhishek Pratap
Hi Guys

I am  in the process of perl to python transition for good.  I wanted to
get some feedback or may be best practice for the following.

1. stitch pipelines : I want python to act as a glue allowing me to run
various linux shell based programs. If needed wait for a program to finish
and then move on, logs if required

2. run the same pipeline but on a local grid if required. (SGE flavor
mainly)

Any modules which can reduce the number of lines i write will be helpful.


Thanks!
-Abhi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] feedback on writing pipelines in python

2012-03-21 Thread Abhishek Pratap
Hi Steve

I agree Steve perl is perfectly fine for the stuff I described but I am
also interested trying alternatives. I am seeing quite interesting data
handling stuff coming up in Python and I would like to try and sometimes as
a programmer I dont like so many ways of doing the same things but it is
subjective. Having many options can be good for some.


-Abhi



On Wed, Mar 21, 2012 at 11:20 AM, Steve Willoughby wrote:

> On 21-Mar-12 11:03, Abhishek Pratap wrote:
>
>> Hi Guys
>>
>> I am  in the process of perl to python transition for good.  I wanted to
>>
>
> Why?  Perl is still a perfectly good tool.  Just not, IMHO, good for
> exactly the same things Python is good for.
>
>
>  1. stitch pipelines : I want python to act as a glue allowing me to run
>> various linux shell based programs. If needed wait for a program to
>> finish and then move on, logs if required
>>
>
> Look at the subprocess standard library module.  It offers a complete set
> of options for launching processes, piping their data aound, waiting for
> them, handling exceptions, and so forth.
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread Alan Gauld

On 21/03/12 13:00, Surya K wrote:

"open" is ambiguous. What do you want to happen? Edit or execute?

I was "double clicking".. and I want to open IDLE.


That's not usually the behavior you want for .py files.
Once you gain experience you will likely have a lot of programs written 
in python, all will be in files ending .py. So you will probably want a 
double click to run those programs. (You should really only use IDLE

to write and debug your programs not for running them)

So it's usually better to add an edit option to your context menu (right 
click) to edit in IDLE. The ActiveState installer sets that up for you 
the official python windows installer doesn't - or didn't

last time I used it - over a year ago now.

Bob has shown you what his settings look like and how to set it
up if you don't already have that option. Just create a new menu
entry rather than modifying the Open entry.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] feedback on writing pipelines in python

2012-03-21 Thread Steve Willoughby

On 21-Mar-12 11:03, Abhishek Pratap wrote:

Hi Guys

I am  in the process of perl to python transition for good.  I wanted to


Why?  Perl is still a perfectly good tool.  Just not, IMHO, good for 
exactly the same things Python is good for.



1. stitch pipelines : I want python to act as a glue allowing me to run
various linux shell based programs. If needed wait for a program to
finish and then move on, logs if required


Look at the subprocess standard library module.  It offers a complete 
set of options for launching processes, piping their data aound, waiting 
for them, handling exceptions, and so forth.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] feedback on writing pipelines in python

2012-03-21 Thread Alan Gauld

On 21/03/12 18:03, Abhishek Pratap wrote:


1. stitch pipelines : I want python to act as a glue allowing me to run
various linux shell based programs. If needed wait for a program to
finish and then move on, logs if required


Python by default reads/writes to stdin/stdout so you can do stuff like:

$ foo.py < fred.txt | bar.py | baz.py > joe.txt

You can also control that explicitly by importing the sys module and 
reassigning sys.stdin/sys.stdout or even reading and writing explicitly 
from those file like objects.


You can also use the subprocess module to execute other programs (either 
Python or any other ind of executable file) in a sub procvess or a 
separate shell and get full control over the pipes, stdin, stdout and 
stderr. Of course that flexibility brings a price and the full power of 
subprocess.Popen is a little complex but there are lots of examples in 
the documentation.



2. run the same pipeline but on a local grid if required. (SGE flavor
mainly)


I confess I have no idea what you mean by a local grid, or an
SGE flavor thereof...

Somebody else will need to address that one!

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] opening a Qt .py file from within another python app.

2012-03-21 Thread ken brockman
Evening all;

I am trying to import a Python QT file, that had been generated from a ui file 
into another python app.
I have imported it, without generating an error, but the Qt window isn't 
opening. I have spent the afternoon googling the issue, have found numerous 
articles, but none that have seemed to work for me. 
I have tried:  import file, from file import *, and a slew of 
other suggested ways to get it to run, all to no avail.

I have tried to call the Class and other Def functions from the Qt file, up to 
and including __main__, but no good.
I have spend well over an hour perusing the Python on line Doc's, but If i had 
stumbled upon the answer I guess I am too slow to have recognized it.

I had come across this great piece on Stack overflow:

There are more than a few ways. I'll list them in order of inverted preference 
(i.e., best first, worst last):
1. Treat it like a module: import file. This is good because it's secure, 
fast, and maintainable. Code gets reused as it's supposed to be done. Most 
Python libraries run using multiple methods stretched over lots of files. 
Highly recommended. Note that if your file is called file.py, your 
import should not include the .py extension at the end.
2. The infamous (and unsafe) exec command: execfile('file.py'). Insecure, 
hacky, usually the wrong answer. Avoid where possible.
3. Spawn a shell process: os.system('python file.py'). Use when desperate.

None of which had gotten the Qt window to open. Yet when I run it directly, on 
it's own, it open's and the Qt window is displayed.

I am hoping it is a relatively simply Task to accomplish, but beyond the 
stunted abilities of my limited knowledge.

At this point I am simply trying to get the Qt window to open from the second 
python app. After which I have a steep hill to climb to try to connect the 
input from the one app to the signals of the other, but that is for another day.


Any and all help, would truly be appreciated.

python3.2, Linux Ubuntu 11.10

Thank you
Ken
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor