Re: Save and load initialized class

2017-12-09 Thread dieter
Bob van der Poel  writes:

> I'm trying to something simple (yeah, right). Mainly I want to have a bunch
> of variables which my program needs and uses to be in a saveable/loadable
> block. Currently I have then all as a bunch of globals which works, but
> trying to keep track of them and the correct spellings, etc becomes a bit
> of maintenance nightmare. So, demonstrating all my cleverness I came up
> with:
>
> class Opts():
>  var1 = 123
>  var2 = "hello world"
> 
> Further, and importantly, I can save the lot with:
>
>   json.dump(Opts.__dict__, open("mybuffer", "w"))
>
> But, I can't figure out how to load the saved data back into my program.
> Doing
>
>   z=json.load (open("mybuffer", "r"))
>
> loads a dictionary ... which makes sense since that is what I saved. So,
> can I now reset the values in Opts from a saved dictionary?

You could use:

  for k, v in z.iteritems: setattr(Opts, k, v)


Of course, this means that you already have a class "Opts" (maybe
without or with different parameter values).


This poses the question why you want to dump/load the class in the first
place. Usually, you would want to have the values in code, not stored/loaded.


If you really want make parameter values persistent, you could use
the following approach:

class ParameterCollection(object):
  def __init__(self, **kwargs):
for k, v in kwargs.iteritems(): setattr(self, k, v)

my_parameters = ParameterCollection(a=1, b=2, )

from pickle import load, dump
dump(my_parameters, open(..., "wb"), -1)
...
my_parameters_reloaded = load(open(..., "rb"))

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: repeating posts

2017-12-09 Thread Gene Heskett
On Saturday 09 December 2017 00:35:15 Rustom Mody wrote:

> Repeating old posts again appearing
>
> [No not complaining… I know people are working on it. Thanks Skip and
> whoever else]
>
> Just thought I'd mention they are now mildly mojibaked

Not familiar with that term.

For me they are highly spammy, and are winding up in my spam box, 
scoreing around 8 because the headers are so mucked up. I train Bayes on 
that folder daily, move it to another folder so I can retrieve it if I 
want to. Thats a very rare occurrence.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: repeating posts

2017-12-09 Thread Chris Angelico
On Sat, Dec 9, 2017 at 8:01 PM, Gene Heskett  wrote:
> On Saturday 09 December 2017 00:35:15 Rustom Mody wrote:
>
>> Repeating old posts again appearing
>>
>> [No not complaining… I know people are working on it. Thanks Skip and
>> whoever else]
>>
>> Just thought I'd mention they are now mildly mojibaked
>
> Not familiar with that term.
>
> For me they are highly spammy, and are winding up in my spam box,
> scoreing around 8 because the headers are so mucked up. I train Bayes on
> that folder daily, move it to another folder so I can retrieve it if I
> want to. Thats a very rare occurrence.

Mojibake is messed up characters caused by mis-encoding or mis-decoding.

https://en.wikipedia.org/wiki/Mojibake

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: repeating posts

2017-12-09 Thread Tim Golden

On 09/12/2017 05:35, Rustom Mody wrote:

Repeating old posts again appearing

[No not complaining… I know people are working on it. Thanks Skip and whoever 
else]

Just thought I'd mention they are now mildly mojibaked



I've just added a new filter and pinged the other list admins / 
postmaster. The same thing on python-announce.


Still not sure if this is malicious or merely a misconfigured 
newsreader. Given the  mojibake, may well be the latter.


TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double click

2017-12-09 Thread alister via Python-list
On Wed, 06 Dec 2017 10:35:58 +1200, Steve D'Aprano wrote:

> On Tue, 5 Dec 2017 07:58 pm, Lawrence Dâ ÖOliveiro wrote:
> 
>> On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote:
>>>
>>> Sounds like your OS file associations are all botched-up ...
>>
>> Linux doesnâ Öt do â £OS file associationsâ Ø.
> 
> 
> Then how does my Linux box know that when I double-click on a text file,
> it launches kwrite rather than (say) the Gimp or LibreOffice?
> 
> When I right-click on a mp4 video, I get a menu that includes a Open
> With command that shows (amount others) Kaffeine, mplayer and VLC.
> 
> If you mean the Linux *kernel* doesn't do file associations, then you
> should have said so.
> 
> But why do you care about the kernel? Would you think it even the
> *tiniest* useful to claim that "Linux doesn't do email" because it is
> sendmail or postfix
>  (or similar) that sends email rather than the Linux kernel itself?

Linux does not associate by file extn it uses a 'magic' file to analyse 
the content of the file so that it runs the correct application 
regardless of the file extn.

to get a python program to run it simply needs the correct "Shebang" ass 
the 1st line

Usually 

#!/usr/bin/env python
 
or similar




-- 
Some say the world will end in fire,
Some say in ice.
From what I've tasted of desire
I hold with those who favor fire.
But if it had to perish twice,
I think I know enough of hate
To say that for destruction, ice
Is also great
And would suffice.
-- Robert Frost, "Fire and Ice"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double click

2017-12-09 Thread Marko Rauhamaa
alister :

> On Wed, 06 Dec 2017 10:35:58 +1200, Steve D'Aprano wrote:
>> Then how does my Linux box know that when I double-click on a text
>> file, it launches kwrite rather than (say) the Gimp or LibreOffice?
>> 
>> When I right-click on a mp4 video, I get a menu that includes a Open
>> With command that shows (amount others) Kaffeine, mplayer and VLC.
>>
>> If you mean the Linux *kernel* doesn't do file associations, then you
>> should have said so.
>> 
>> But why do you care about the kernel? Would you think it even the
>> *tiniest* useful to claim that "Linux doesn't do email" because it is
>> sendmail or postfix (or similar) that sends email rather than the
>> Linux kernel itself?
>
> Linux does not associate by file extn it uses a 'magic' file to
> analyse the content of the file so that it runs the correct
> application regardless of the file extn.

"Linux" is one of those words that has ceased to have much meaning.
Personally, I wouldn't think "double-clicking on a text file" has
anything to do with linux. I use linux during most of my waking hours
but I don't remember ever "double-clicking on a text file".

BTW, with the triumph of systemd, I would say linux is falling ever more
to the background. I am thinking more and more that "Linux" is a bad
generic name for the modern distros. Instead, we should talk about
"systemd" as the overall name of the OS. Linux really is a relatively
minor component in the mind of the user or the application developer.
For example, Linux doesn't dictate how one should develop a system
service; systemd calls the shots.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: scipy

2017-12-09 Thread Thomas Jollans
On 08/12/17 23:57, Larry Martell wrote:
> Trying to install scipy on ubuntu-trusty-64 running Python 2.7.6. 

I STRONGLY recommend moving to Python 3 if you can. The scientific
python ecosystem has had good support for Python 3 for years now. Many
scientific packages, including numpy (the king of scientific
Pythonland), have decided to drop official Python 2 support fairly soon;
numpy will not release any new versions for Python 2 after 2018.

See: http://www.python3statement.org/

Trusty includes Python 3.3. Ubuntu trusty also has scipy packages.
Installing with

sudo apt-get install python3-scipy
# or python-scipy, if you insist in being stuck on Python 2.7

is probably the easiest option. This will, of course, give you an
equally dated version of scipy.

If you want current versions of Python and scientific packages on an old
OS, I recommend you have a look at Anaconda.

> It's failing with:
> 
> $ sudo pip install scipy
> Downloading/unpacking scipy
>   Downloading scipy-1.0.0.tar.gz (15.2MB): 15.2MB downloaded
>   Running setup.py (path:/tmp/pip_build_root/scipy/setup.py) egg_info
> for package scipy
> /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> distribution option: 'python_requires'
> 
> Followed by many screens full of errors. Is that just a warning or is
> that the issue? I've installed many other packages without a problem
> on this same system. What is the issue here?
> 

I'm just guessing here, but do you have the latest versions of
distutils, setuptools and pip? It's likely that scipy requires newer
versions of these than your distribution provides. You may have to
upgrade them.

Best of luck,

Thomas

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Save and load initialized class

2017-12-09 Thread MRAB

On 2017-12-08 18:36, Bob van der Poel wrote:

I'm trying to something simple (yeah, right). Mainly I want to have a bunch
of variables which my program needs and uses to be in a saveable/loadable
block. Currently I have then all as a bunch of globals which works, but
trying to keep track of them and the correct spellings, etc becomes a bit
of maintenance nightmare. So, demonstrating all my cleverness I came up
with:

class Opts():
  var1 = 123
  var2 = "hello world"

Notationally, it looks much like the variables are stored in a separate
module. I can call these options from within a function with the simple
notation:

   if Opts.var1 == 99 ...

And, if I need to change a value I can:

  global
  Opts.var1 = 0

Further, and importantly, I can save the lot with:

   json.dump(Opts.__dict__, open("mybuffer", "w"))

But, I can't figure out how to load the saved data back into my program.
Doing

   z=json.load (open("mybuffer", "r"))

loads a dictionary ... which makes sense since that is what I saved. So,
can I now reset the values in Opts from a saved dictionary?


Try updating __dict__:

Opts.__dict__.update(json.load(open("mybuffer")))
--
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double click

2017-12-09 Thread Chris Angelico
On Sun, Dec 10, 2017 at 12:58 AM, Marko Rauhamaa  wrote:
> alister :
>
>> On Wed, 06 Dec 2017 10:35:58 +1200, Steve D'Aprano wrote:
>>> Then how does my Linux box know that when I double-click on a text
>>> file, it launches kwrite rather than (say) the Gimp or LibreOffice?
>>>
>>> When I right-click on a mp4 video, I get a menu that includes a Open
>>> With command that shows (amount others) Kaffeine, mplayer and VLC.
>>>
>>> If you mean the Linux *kernel* doesn't do file associations, then you
>>> should have said so.
>>>
>>> But why do you care about the kernel? Would you think it even the
>>> *tiniest* useful to claim that "Linux doesn't do email" because it is
>>> sendmail or postfix (or similar) that sends email rather than the
>>> Linux kernel itself?
>>
>> Linux does not associate by file extn it uses a 'magic' file to
>> analyse the content of the file so that it runs the correct
>> application regardless of the file extn.
>
> "Linux" is one of those words that has ceased to have much meaning.
> Personally, I wouldn't think "double-clicking on a text file" has
> anything to do with linux. I use linux during most of my waking hours
> but I don't remember ever "double-clicking on a text file".

And there are plenty of people who use Python all their waking hours,
but never once write a generator function. Systems like this are large
enough that different people get to use different subsets of the
functionality. There's a HUGE difference between "using Linux for
headless servers" and "using Linux for software development" and
"using Linux for video editing" in terms of which features you'll use.
I, for instance, couldn't *imagine* using Linux without SSH, but my
mother uses Linux too and has never SSH'd to a different computer for
any reason. On the other hand, she makes extensive use of Libre
Office, which I only have installed for those rare occasions when
someone sends me a spreadsheet file or something. But we're both using
Linux, and that's perfectly acceptable use of terminology.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-12-09 Thread Terry Reedy

On 12/9/2017 5:57 AM, Gilmeh Serda wrote:


And next demands to allow Unicode as keywords in a translated version of
Python


Python's liberal open source license allows people to revise and 
distribute their own python or python-like interpreters.  I believe 
there are already a couple of non-english versions aimed at schoolkids. 
The cpython core developer group has nothing to do with such.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-12-09 Thread Steve D'Aprano
On Sun, 10 Dec 2017 09:20 am, Terry Reedy wrote:

> On 12/9/2017 5:57 AM, Gilmeh Serda wrote:
> 
>> And next demands to allow Unicode as keywords in a translated version of
>> Python
> 
> Python's liberal open source license allows people to revise and
> distribute their own python or python-like interpreters.  I believe
> there are already a couple of non-english versions aimed at schoolkids.
> The cpython core developer group has nothing to do with such.

I don't know who their target audiences are, but there's a German and Chinese
version of Python.

http://www.fiber-space.de/EasyExtend/doc/teuton/teuton.htm

http://www.chinesepython.org/english/english.html

My *guess* is that Teuton is intended as a proof-of-concept just to show it
can be done, and ChinesePython is intended for students.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Benefits of unicode identifiers (was: Allow additional

2017-12-09 Thread Steve D'Aprano
On Sat, 9 Dec 2017 09:57 am, Gilmeh Serda wrote:

> And next demands to allow Unicode as keywords in a translated version of
> Python
>  will make open source go away. For good.


Do you seriously think that because *one* project forks their code base and
introduces non-English keywords, the tens of hundreds of thousands of other
projects (including *enormous* projects like the Linux kernel, LibreOffice,
Apache, Mozilla, etc) will all say "well, that's it, we're shutting down"?



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Steve D'Aprano
On Fri, 8 Dec 2017 12:08 pm, Python wrote:

> But more importantly, practically speaking, it still doesn't really
> provide much more help to the OP than Lawrence's answer.

I wasn't responding to the OP, I was responding to Lawrence. If I had a
solution for the OP beyond what others have already said (especially Thomas
Jollans' link to an AskUbuntu post), I would have given it.

Practically speaking, your responses to me don't help the OP either, do they?
So why single me out for criticism for *exactly* the same thing that you
yourself are doing?


> He may well 
> know already that the desktop environment is what does the job (and
> probably does even, in broad terms, if he's familiar with computers in
> general), but have no idea how to configure it.

Anything is possible, but if he were that clueful, he would know that this has
nothing to do with Python and he should be asking in a forum dedicated to his
preferred desktop environment. The fact that this is a Python script is
irrelevant.


> A reasonably helpful 
> answer would be one that mentioned a few of the likely possibilities
> (Gnome, KDE, Unity, /etc/mime.types, "other"), and gave hints for how
> to find out the answer for each.  A thoroughly helpful answer would
> be, well, outside the scope of this list/group.

Arguably -- and I'm not sure that I personally would take this position -- it
might be said that somebody clueless enough to ask a desktop-specific
question without specifying which desktop he is running, would only be
confused rather than enlightened by an answer which lists three or more
desktops.

If we take a user-centric position, there's a lot to be said for the
attitude "Don't bother me with technical details, I just want to make the
file executable when I double-click on it".

(I presume that there's a single, trivial, right answer to this question on
Mac OS and Windows.)


> Pedantry has its place, FWIW. In the computer field, as with other
> science and engineering disciplines, often precision is much more
> essential than in other fields.  I personally find such precision is
> especially warranted if you take it upon yourself to criticize what
> someone else has said.

There's a famous story where some English Lit student took it upon themselves
to criticise Isaac Asimov for his claim to be living in a century where we
finally knew the basics of how the universe worked. Asimov's response was to
quote something he had once told his editor, John Campbell:

[W]hen people thought the earth was flat, they were wrong. When people
thought the earth was spherical, they were wrong. But if you think that
thinking the earth is spherical is just as wrong as thinking the earth
is flat, then your view is wronger than both of them put together.

http://hermiene.net/essays-trans/relativity_of_wrong.html

https://en.wikipedia.org/wiki/Wronger_than_wrong

(This is becoming ever more relevant again, as for some reason -- possibly
Poe's Law -- the number of people on the Internet claiming to believe the
world is flat is on the rise.)

If you think that my statement is just as wrong as Lawrence's statement,
you're wronger than both of us together :-)


Remember the context here: we're replying to a thread discussing somebody who
is running Ubuntu with a GUI desktop environment. Of course there are *some*
Linux systems which don't run a GUI at all, but you can't double-click on
files on such systems, and they aren't Ubuntu, so they aren't relevant.


> Though, providing such precision via natural 
> language often turns out to be more challenging than one would hope...

Indeed.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Chris Angelico
On Sun, Dec 10, 2017 at 12:56 PM, Steve D'Aprano
 wrote:
> Remember the context here: we're replying to a thread discussing somebody who
> is running Ubuntu with a GUI desktop environment. Of course there are *some*
> Linux systems which don't run a GUI at all, but you can't double-click on
> files on such systems, and they aren't Ubuntu, so they aren't relevant.

Been a long time since I had an Ubuntu, but is it really the case that
you can't install Ubuntu without a GUI? Anyhow, your first part is
correct: without a GUI, you can't exactly double-click on a file.

(No doubt someone's going to become even more pedantic now and point
out some way in which you can double-click something without a GUI.
Probably involving networked file systems or something. If I've
learned one thing from this list, it's that there is ALWAYS someone
more pedantic than you are.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Michael Torrie
On 12/09/2017 08:01 PM, Chris Angelico wrote:
> Been a long time since I had an Ubuntu, but is it really the case that
> you can't install Ubuntu without a GUI? 

Of course not.  Ubuntu is used in headless server situations all the time.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Benefits of unicode identifiers (was: Allow additional separator in identifiers)

2017-12-09 Thread Thomas Jollans
On 10/12/17 02:42, Steve D'Aprano wrote:
> On Sun, 10 Dec 2017 09:20 am, Terry Reedy wrote:
> 
>> On 12/9/2017 5:57 AM, Gilmeh Serda wrote:
>>
>>> And next demands to allow Unicode as keywords in a translated version of
>>> Python
>>
>> Python's liberal open source license allows people to revise and
>> distribute their own python or python-like interpreters.  I believe
>> there are already a couple of non-english versions aimed at schoolkids.
>> The cpython core developer group has nothing to do with such.
> 
> I don't know who their target audiences are, but there's a German and Chinese
> version of Python.
> 
> http://www.fiber-space.de/EasyExtend/doc/teuton/teuton.htm
> 
> http://www.chinesepython.org/english/english.html
> 
> My *guess* is that Teuton is intended as a proof-of-concept just to show it
> can be done,

That's certainly what it looks like, though the documentation page reads
like a bad joke (or a once-mediocre one that really hasn't aged well).

Joke or not, it does appear to be real, however, and a part of this long
dead and forgotten package: https://pypi.python.org/pypi/EasyExtend/3.0.1

-- Thomas
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Chris Angelico
On Sun, Dec 10, 2017 at 2:39 PM, Michael Torrie  wrote:
> On 12/09/2017 08:01 PM, Chris Angelico wrote:
>> Been a long time since I had an Ubuntu, but is it really the case that
>> you can't install Ubuntu without a GUI?
>
> Of course not.  Ubuntu is used in headless server situations all the time.

That's what I thought. Anyhow, the other half still stands.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Thomas Jollans
On 10/12/17 04:01, Chris Angelico wrote:
> but is it really the case that you can't install Ubuntu without a GUI?

Of course not. There are millions of people using Ubuntu on servers,
without as much as a whiff of GUI.

I'm rather sure that the server version of Ubuntu makes significantly
more money for Canonical than the desktop one, too.

-- Thomas

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Rustom Mody
On Friday, December 8, 2017 at 6:40:17 AM UTC+5:30, Python wrote:
> On Thu, Dec 07, 2017 at 01:29:11PM +1100, Steve D'Aprano wrote:
> > On Thu, 7 Dec 2017 08:22 am, Python wrote:
> > >> > Linux doesn’t do “OS file associations”.
> > >> 
> > >> Then how does my Linux box know that when I double-click on a text file, 
> > >> it
> > >> launches kwrite rather than (say) the Gimp or LibreOffice?
> > > 
> > > The answer to that is (sadly) complicated.
> > 
> > Actually, no, the answer to my question is very simple: Lawrence is mistaken
> > about Linux not doing file associations. It does -- it is merely handled by
> > the desktop environment (if there is one).
> 
> Pedantically speaking, this is only *probably true*, not certainly
> true (e.g. running Linux on a text console with something like
> midnight commander, some unrelated file manager while running a
> particular desktop environment, etc.).  
> 
> But more importantly, practically speaking, it still doesn't really
> provide much more help to the OP than Lawrence's answer.  He may well
> know already that the desktop environment is what does the job (and
> probably does even, in broad terms, if he's familiar with computers in
> general), but have no idea how to configure it.  A reasonably helpful
> answer would be one that mentioned a few of the likely possibilities
> (Gnome, KDE, Unity, /etc/mime.types, "other"), and gave hints for how
> to find out the answer for each.  A thoroughly helpful answer would
> be, well, outside the scope of this list/group.
> 
> Pedantry has its place, FWIW. In the computer field, as with other
> science and engineering disciplines, often precision is much more
> essential than in other fields.  I personally find such precision is
> especially warranted if you take it upon yourself to criticize what
> someone else has said.  Though, providing such precision via natural
> language often turns out to be more challenging than one would hope...


I was sending some files to some students. 
Since it was more than one, the natural choice was a tarball.
[I believe that since it was a very tiny total space I did not compress the 
tarball… but I dont remember this part exactly]
The point is that instead of sending a stuff.tgz or stuff.tar file I sent a 
file 
called just stuff; ie I must have done:
$ tar xvf stuff directory
rather than the more normal
$ tar xvf stuff.tar directory

I got a return mail soon enough: “Your file is corrupt; it wont open”
(in file-roller or whatever tar-GUI the kids nowadays use)

I could have given them the answer: There are no associations in
Linux. Just
$ mv stuff stuff.tar
and it will work
As it happens I am lazy; easier to believe that my file was "wrongly" named;
did the mv myself, and resent the now "correct" tarball; problem solved.


Whether there was nothing wrong in what I did, the "wrong-right" was de facto,
or de jure… I will leave to more wise persons than myself
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Rustom Mody
On Sunday, December 10, 2017 at 10:12:38 AM UTC+5:30, Rustom Mody wrote:

> I was sending some files to some students. 
> Since it was more than one, the natural choice was a tarball.
> [I believe that since it was a very tiny total space I did not compress the 
> tarball… but I dont remember this part exactly]
> The point is that instead of sending a stuff.tgz or stuff.tar file I sent a 
> file 
> called just stuff; ie I must have done:
> $ tar xvf stuff directory
> rather than the more normal
> $ tar xvf stuff.tar directory

Er… Not xvf of course but cvf
[And yeah the v is not necessary]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Frank Millman
"Rustom Mody"  wrote in message 
news:4f25d0a9-64a5-4d36-b072-97e293a7c...@googlegroups.com...




I was sending some files to some students.
Since it was more than one, the natural choice was a tarball.
[I believe that since it was a very tiny total space I did not compress the
tarball… but I dont remember this part exactly]
The point is that instead of sending a stuff.tgz or stuff.tar file I sent a 
file

called just stuff; ie I must have done:
$ tar xvf stuff directory
rather than the more normal
$ tar xvf stuff.tar directory

I got a return mail soon enough: “Your file is corrupt; it wont open”
(in file-roller or whatever tar-GUI the kids nowadays use)

I could have given them the answer: There are no associations in
Linux. Just
$ mv stuff stuff.tar
and it will work
As it happens I am lazy; easier to believe that my file was "wrongly" named;
did the mv myself, and resent the now "correct" tarball; problem solved.



I had a similar experience a few years ago, but the recipient was not a 
student, but a bank's IT department!


I had to send them an encrypted document, and their spec specified PGP. I 
used GPG instead, which produces exactly the same result, but with a .gpg 
file extension.


I was told that my file did not work. After much time trying to figure out 
what was wrong, I spoke to one of their staff over the phone, and asked him 
to right-click on the file, select 'rename', and change '.gpg' to '.pgp'. He 
did so, tried again, and said 'Ah, now it works'.


Frank Millman


--
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Steve D'Aprano
On Sun, 10 Dec 2017 02:01 pm, Chris Angelico wrote:

> On Sun, Dec 10, 2017 at 12:56 PM, Steve D'Aprano
>  wrote:
>> Remember the context here: we're replying to a thread discussing somebody
>> who is running Ubuntu with a GUI desktop environment. Of course there are
>> *some* Linux systems which don't run a GUI at all, but you can't
>> double-click on files on such systems, and they aren't Ubuntu, so they
>> aren't relevant.
> 
> Been a long time since I had an Ubuntu, but is it really the case that
> you can't install Ubuntu without a GUI?

I mispoke -- I meant something like "they aren't whatever Ububtu GUI the OP
has installed".

There is, apparently, headless Ubuntu, but it isn't clear to me whether they
install X (or Mir, Wayland or some other alternative) or not. E.g. this:

https://www.howtoforge.com/tutorial/ubuntu-gnome-vnc-headless-server/

seems to suggest to me that X.org is already installed, I can see X utils
being installed as a recommended package but I couldn't spot X being added as
a dependency. So my *guess* is that even headless Ubuntu server includes an X
server. (Or possibly Mir.)



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)

2017-12-09 Thread Chris Angelico
On Sun, Dec 10, 2017 at 4:52 PM, Steve D'Aprano
 wrote:
> On Sun, 10 Dec 2017 02:01 pm, Chris Angelico wrote:
>
>> On Sun, Dec 10, 2017 at 12:56 PM, Steve D'Aprano
>>  wrote:
>>> Remember the context here: we're replying to a thread discussing somebody
>>> who is running Ubuntu with a GUI desktop environment. Of course there are
>>> *some* Linux systems which don't run a GUI at all, but you can't
>>> double-click on files on such systems, and they aren't Ubuntu, so they
>>> aren't relevant.
>>
>> Been a long time since I had an Ubuntu, but is it really the case that
>> you can't install Ubuntu without a GUI?
>
> I mispoke -- I meant something like "they aren't whatever Ububtu GUI the OP
> has installed".
>
> There is, apparently, headless Ubuntu, but it isn't clear to me whether they
> install X (or Mir, Wayland or some other alternative) or not. E.g. this:
>
> https://www.howtoforge.com/tutorial/ubuntu-gnome-vnc-headless-server/
>
> seems to suggest to me that X.org is already installed, I can see X utils
> being installed as a recommended package but I couldn't spot X being added as
> a dependency. So my *guess* is that even headless Ubuntu server includes an X
> server. (Or possibly Mir.)

Or that installing a VNC server automatically installs X11 or
equivalent. That's what I'd expect, though it's entirely possible that
a headless server still gets certain libraries installed.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list