Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73978 > unrolled thread

This Python script cannot open by a editor?

Started byrxjwg98@gmail.com
First post2014-07-04 14:50 -0700
Last post2014-07-05 11:40 -0400
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  This Python script cannot open by a editor? rxjwg98@gmail.com - 2014-07-04 14:50 -0700
    Re: This Python script cannot open by a editor? jkn <jkn_gg@nicorp.f9.co.uk> - 2014-07-04 15:06 -0700
    Re: This Python script cannot open by a editor? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-04 23:37 +0000
      Re: This Python script cannot open by a editor? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-07-05 11:40 -0400

#73978 — This Python script cannot open by a editor?

Fromrxjwg98@gmail.com
Date2014-07-04 14:50 -0700
SubjectThis Python script cannot open by a editor?
Message-ID<62a534ec-c22f-451e-80f7-c6f49a8cbcc1@googlegroups.com>
Hi,

I am learning a Python Tool from web: 
http://www.ohwr.org/projects/hdl-make/wiki/Quick-start-new

I download the program to Ubuntu 12.04. I find that in the folder it is shown as
hdlmake-v1.0, 37.8 KB Python Script. I remember that script file can be loaded
to an editor to read its content. But, when I open it by double click, it is
shown as like binary file in GEDIT. 

What is the reason of this?

A general Python file has .py extension, and can be edited. Is it right?

Thanks

[toc] | [next] | [standalone]


#73979

Fromjkn <jkn_gg@nicorp.f9.co.uk>
Date2014-07-04 15:06 -0700
Message-ID<b98a870d-9003-473a-8d57-a36f883320a2@googlegroups.com>
In reply to#73978
Hi there
    the script is 'actually' a python script compressed, with a short header (see the '#!/usr/bin/python' right at the front? I'm guessing that if you make it executable, and run it, then it will either create a .py file that you can edit, or just run the hdlmake function that you want.

This is not very well explained on the wiki page that you link to... you might also try downloading the alternative distributions on the download page.

    HTH
    jon N

[toc] | [prev] | [next] | [standalone]


#73983

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-07-04 23:37 +0000
Message-ID<53b73ab9$0$29985$c3e8da3$5496439d@news.astraweb.com>
In reply to#73978
On Fri, 04 Jul 2014 14:50:02 -0700, rxjwg98 wrote:

> Hi,
> 
> I am learning a Python Tool from web:
> http://www.ohwr.org/projects/hdl-make/wiki/Quick-start-new

Did you read that web page? It says:

    To get the code you have two choices: you might clone the 
    repository, which contains the most recent changes (more 
    features, more bugs too...) or download a frozen version 
    in a form of a "binary" file.


> I download the program to Ubuntu 12.04. I find that in the folder it is
> shown as hdlmake-v1.0, 37.8 KB Python Script. 

At the bash shell from inside that folder, run:

    file hdlmake-v1.0


What does it say?



> I remember that script
> file can be loaded to an editor to read its content. But, when I open it
> by double click, it is shown as like binary file in GEDIT.
> 
> What is the reason of this?

Because it is a binary file.


> A general Python file has .py extension, and can be edited. Is it right?

Python *source code* normally has a .py extension, although it could have 
no extension at all.

Python *byte code* is a binary file, usually with a .pyc or .pyo 
extension. On Windows, sometimes you also get .pyw.

You can also get Python code inside a zip file, which may have a .zip 
extension. On Windows, you can get Python code frozen in a .exe file, and 
I believe on Mac you can get it frozen in a .app file.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#73994

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2014-07-05 11:40 -0400
Message-ID<mailman.11521.1404574845.18130.python-list@python.org>
In reply to#73983
On 04 Jul 2014 23:37:30 GMT, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> declaimed the following:

>Python *byte code* is a binary file, usually with a .pyc or .pyo 
>extension. On Windows, sometimes you also get .pyw.
>
	.pyw is source code intended to be run without a normal console window
opening up (and hence no stdin/stdout)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web