Re: Please tell me how to execute python file in Ubuntu by double
Grant Edwards wrote: Where are the UTIs stored? Do OS X filesystems still have a "resource fork"? UTIs are stored as extended attributes. Resource forks still exist, but they're deprecated. Things that used to be kept in resource forks are now usually just files in the application bundle -- which is just a specially marked directory as far as the OS is concerned. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
Steve D'Aprano wrote: They are still supported (-ish) by OS X, but have been superseded by Uniform Type Identifiers. https://en.wikipedia.org/wiki/Uniform_Type_Identifier I know, what I'm not sure about is how much those are used by apps these days, with so much of the widely used software being multi-platform. The Finder doesn't make it easy to tell -- it just shows you which app is the default one for a file, without any details as to how it's determining that. And if you change the default app for a file, it asks "Do you want to open all file like this with ?", but it's not very clear what "like" means for a given file. It could mean "having the same suffix", "having the same UTI", or "having the same legacy type code". -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On 2017-12-15, Steve D'Aprano wrote: > On Fri, 15 Dec 2017 09:48 am, Gregory Ewing wrote: [...] > Classic MacOS associated two such pieces of metadata with each file: the > creator and type. [...] > > https://en.wikipedia.org/wiki/Creator_code > >> I believe MacOSX also has the ability to store a file type as >> metadata, but it doesn't seem to be used much. > > They are still supported (-ish) by OS X, but have been superseded by Uniform > Type Identifiers. Where are the UTIs stored? Do OS X filesystems still have a "resource fork"? -- Grant Edwards grant.b.edwardsYow! I smell like a wet at reducing clinic on Columbus gmail.comDay! -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Fri, 15 Dec 2017 11:48:20 +1300, Gregory Ewing wrote: > Rhodri James wrote: >> Even then there was RiscOS, which divorced file names from file types >> entirely. > > As did classic MacOS. > > I believe MacOSX also has the ability to store a file type as metadata, > but it doesn't seem to be used much. Amiga os used a separate file as the ICON & this contained lots of meta data including which application to open the file with (usualy the application that created it) -- "I'd love to go out with you, but I have to stay home and see if I snore." -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Fri, 15 Dec 2017 09:48 am, Gregory Ewing wrote: > Rhodri James wrote: >> Even then there was RiscOS, which divorced file names from file types >> entirely. > > As did classic MacOS. Classic MacOS associated two such pieces of metadata with each file: the creator and type. Regardless of the optional file type extension, you could associate different creators with different files of the same type: https://en.wikipedia.org/wiki/Creator_code > I believe MacOSX also has the ability to store a file type > as metadata, but it doesn't seem to be used much. They are still supported (-ish) by OS X, but have been superseded by Uniform Type Identifiers. https://en.wikipedia.org/wiki/Uniform_Type_Identifier -- 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
Rhodri James wrote: Even then there was RiscOS, which divorced file names from file types entirely. As did classic MacOS. I believe MacOSX also has the ability to store a file type as metadata, but it doesn't seem to be used much. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Fri, Dec 15, 2017 at 3:06 AM, Dennis Lee Bieber wrote: > C:\Users\Wulfraed>assoc .docx > .docx=Word.Document.12 > > C:\Users\Wulfraed>ftype word.document.12 > word.document.12="C:\Program Files\Microsoft > Office\Root\Office16\WINWORD.EXE" /n "%1" /o "%u" I'm almost afraid to ask... why "word.document.12" and why "Office16"? If only one of those, I would guess that it's a version number ("Office16" ==> MS Office 2016?), but there are two of them and they disagree... ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Thu, Dec 14, 2017 at 10:53 PM, Rhodri James wrote: > On 14/12/17 07:25, Chris Angelico wrote: >> >> So it's an imperfect solution even as far as it goes, and a highly >> limiting way to do things. I'm sure it made good sense back when >> MS-DOS file systems ruled the Windows world, and 8.3 was just the way >> of things. > > > Even then there was RiscOS, which divorced file names from file types > entirely. A file's type was part of its directory data, and that was what > determined what happened when you double-clicked on it. You were still > limited to only one default application (and icon, and so on) per file type, > so OS/2 still wins on that front, but I always felt that having names > determine types was somehow mucky. > Having names as the *sole* way to determine types? I agree. But as one of a suite of methods? It makes a decent default. There are plenty of files out there whose names correctly match (a) their contents and (b) what you want to do with them, so forcing people to ALSO choose a type in some other way is redundant. But if a file can have an explicit type or "no type specified", and in the latter case it uses a filename-based mapping, that would be a slab of the functionality right there. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On 14/12/17 07:25, Chris Angelico wrote: So it's an imperfect solution even as far as it goes, and a highly limiting way to do things. I'm sure it made good sense back when MS-DOS file systems ruled the Windows world, and 8.3 was just the way of things. Even then there was RiscOS, which divorced file names from file types entirely. A file's type was part of its directory data, and that was what determined what happened when you double-clicked on it. You were still limited to only one default application (and icon, and so on) per file type, so OS/2 still wins on that front, but I always felt that having names determine types was somehow mucky. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Thu, Dec 14, 2017 at 5:44 PM, Christian Gollwitzer wrote: > Am 14.12.17 um 02:55 schrieb Chris Angelico: >> >> On Thu, Dec 14, 2017 at 12:35 PM, Rick Johnson >> wrote: >>> >>> On Tuesday, December 12, 2017 at 10:42:54 PM UTC-6, eryk sun wrote: >>> [...] That said, I don't see this feature as being very useful compared to just using "open with" when I occasionally need to open a file with a non-default program. >>> >>> >>> That's the point i was trying to make, but i think it may >>> have whoooshed over Chris's head. ;-) >> >> >> No, it didn't. I just happen to have about twelve years' experience >> with a GUI system that has this as a feature, and I found it extremely >> helpful. It's funny how our experience colours our expectations, isn't >> it? We just won't settle for trash once we've tasted quality. >> > > I'm still unconvinced that this is much different from the Windows way > (though I haven't used OS/2, so I'm probably missing something): > > Suppose, you have a file "Letter.txt" in your Documents folder on Windows. > With standard settings, the "dumb" user (non IT expert) does not see the > ".txt". It shows up as "Letter" with an icon for "written text". If you > double click on it, Notepad will come up. If you right click, you'll see a > list of programs which can open text files: Notepad, Wordpad, MS Word, any > other editor you might have installed. > > How is the file extension different (to the regular user!) than a file type > information stored in an alternate stream? Both are normally invisible and > determine a default application as well as a number of programs which can > open/edit the file. If you accept that a file's name consists of the "visible part" and the "part that affects file associations", then I suppose you could say that Windows allows you to customize a file's associations. However: 1) You can use this to select a file's category, but a file has to be in precisely one category. A file cannot be both a "text file" (associated with your editor of choice) and a "program file" (associated with "run this program") unless you create a "text program file" hybrid type and manually control your associations. Want to install a new text editor? Sure. Go associate it with all of your text types. With OS/2's type system, a program can choose on installation to associate itself with "Plain Text", and then all text-y files will see that program in their "Open With" sets, even if they're another type as well (maybe "Makefile", associated with make). 2) The sort of user who would consider the file extension to be out-of-band information is NOT going to be inventing new file extensions and crafting associations for them. So you're basically limited to those categories that have been set up by someone else. > The only thing I can see from your description, apparently it was possible > to change the default for an individual file ("Open this file always with > Wordpad instead of Notepad") without changing th eglobal default. Is this > the missing feature? 3) This. It's impossible to have one file in a category have a different default; you have to change the whole category's configuration. 4) A file's "category" also controls other things than its program association(s), such as its icon. So if you want to invent a new file category, you have to replicate all those other settings. 5) And the big one: you have to accept that the file name is no longer in your control. So this fundamentally won't work with any file that is looked for by another program, other than in the specific way of "this is the file you clicked on". So you can't choose the editor for an ancillary config file, you can't subcategorize your Python scripts and still import them successfully, and you basically can't categorize dotfiles (because ".bashrc" is of the type "bashrc", whereas ".zshrc" is of the completely different type "zshrc"). So it's an imperfect solution even as far as it goes, and a highly limiting way to do things. I'm sure it made good sense back when MS-DOS file systems ruled the Windows world, and 8.3 was just the way of things. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
Am 14.12.17 um 02:55 schrieb Chris Angelico: On Thu, Dec 14, 2017 at 12:35 PM, Rick Johnson wrote: On Tuesday, December 12, 2017 at 10:42:54 PM UTC-6, eryk sun wrote: [...] That said, I don't see this feature as being very useful compared to just using "open with" when I occasionally need to open a file with a non-default program. That's the point i was trying to make, but i think it may have whoooshed over Chris's head. ;-) No, it didn't. I just happen to have about twelve years' experience with a GUI system that has this as a feature, and I found it extremely helpful. It's funny how our experience colours our expectations, isn't it? We just won't settle for trash once we've tasted quality. I'm still unconvinced that this is much different from the Windows way (though I haven't used OS/2, so I'm probably missing something): Suppose, you have a file "Letter.txt" in your Documents folder on Windows. With standard settings, the "dumb" user (non IT expert) does not see the ".txt". It shows up as "Letter" with an icon for "written text". If you double click on it, Notepad will come up. If you right click, you'll see a list of programs which can open text files: Notepad, Wordpad, MS Word, any other editor you might have installed. How is the file extension different (to the regular user!) than a file type information stored in an alternate stream? Both are normally invisible and determine a default application as well as a number of programs which can open/edit the file. The only thing I can see from your description, apparently it was possible to change the default for an individual file ("Open this file always with Wordpad instead of Notepad") without changing th eglobal default. Is this the missing feature? Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Thu, Dec 14, 2017 at 12:35 PM, Rick Johnson wrote: > On Tuesday, December 12, 2017 at 10:42:54 PM UTC-6, eryk sun wrote: > [...] >> That said, I don't see this feature as being very useful >> compared to just using "open with" when I occasionally need >> to open a file with a non-default program. > > That's the point i was trying to make, but i think it may > have whoooshed over Chris's head. ;-) No, it didn't. I just happen to have about twelve years' experience with a GUI system that has this as a feature, and I found it extremely helpful. It's funny how our experience colours our expectations, isn't it? We just won't settle for trash once we've tasted quality. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Tuesday, December 12, 2017 at 10:42:54 PM UTC-6, eryk sun wrote: [...] > That said, I don't see this feature as being very useful > compared to just using "open with" when I occasionally need > to open a file with a non-default program. That's the point i was trying to make, but i think it may have whoooshed over Chris's head. ;-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Wed, Dec 13, 2017 at 9:04 PM, Chris Angelico wrote: > On Thu, Dec 14, 2017 at 7:56 AM, eryk sun wrote: >> On Wed, Dec 13, 2017 at 5:43 AM, Chris Angelico wrote: >>> >>> A Windows equivalent would be to have a .py file associated normally >>> with the regular console, but some individual ones associated with >>> pythonw.exe - without renaming them to .pyw. AFAIK there is no way to >>> do this on Windows short of renaming the files. >> >> If using another file is ok, then a shell shortcut or hard link would >> work.A symbolic link doesn't work because it seems the shell resolves >> the link before querying the file association. > > As workarounds go, a hardlink isn't too bad. (A shell shortcut has its > own problems and limitations.) But you still need to be able to define > a filename pattern, usually by specifying an extension, that catches > the alternates. So it's definitely a workaround, not a true feature. I think a shell shortcut is a good workaround. It's less obtrusive than a hard link since the script still has the same name. The command line would be something like `"C:\Windows\pyw.exe" "path\to\script.py"`. Clear the shortcut's "start in" field to make pyw.exe inherit the working directory of the parent process. Add .LNK to the PATHEXT environment variable to support executing "script.lnk" as "script". -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Thu, Dec 14, 2017 at 7:56 AM, eryk sun wrote: > On Wed, Dec 13, 2017 at 5:43 AM, Chris Angelico wrote: >> >> A Windows equivalent would be to have a .py file associated normally >> with the regular console, but some individual ones associated with >> pythonw.exe - without renaming them to .pyw. AFAIK there is no way to >> do this on Windows short of renaming the files. > > If using another file is ok, then a shell shortcut or hard link would > work.A symbolic link doesn't work because it seems the shell resolves > the link before querying the file association. As workarounds go, a hardlink isn't too bad. (A shell shortcut has its own problems and limitations.) But you still need to be able to define a filename pattern, usually by specifying an extension, that catches the alternates. So it's definitely a workaround, not a true feature. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Wed, Dec 13, 2017 at 5:43 AM, Chris Angelico wrote: > > A Windows equivalent would be to have a .py file associated normally > with the regular console, but some individual ones associated with > pythonw.exe - without renaming them to .pyw. AFAIK there is no way to > do this on Windows short of renaming the files. If using another file is ok, then a shell shortcut or hard link would work.A symbolic link doesn't work because it seems the shell resolves the link before querying the file association. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Wed, Dec 13, 2017 at 3:41 PM, eryk sun wrote: > On Tue, Dec 12, 2017 at 3:30 PM, Chris Angelico wrote: >> On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson >> wrote: >>> Chris Angelico wrote: >>> Which is why OS/2, back in the 1990s, had *multiple* associations for any given file. You could use file types (sadly not MIME types - this was before MIME was the one obvious standard to use) to identify *any number* of programs that are likely to be used with a file, and then one of them is the global default. For any specific file, you can change which program is its own default, and even add specific associations for that individual file. When you double-click, you get the default; if you right-click and choose "Open", you could pick from the associated programs. A good system, and one that I still haven't seen replicated in a mainstream OS. >>> >>> Windows has the same features. >> >> It does? Show me how to specify that one file - which might have the >> exact same name as many similar files - should be associated with a >> different program than the one its name would normally suggest. Show >> me how to identify multiple file types for a given file, independently >> of its filename. > > AFAIK that's not currently possible in Windows -- at least not without > writing a custom shell extension. Hypothetically, the shell could > support something like this on NTFS drives by storing a perceived type > (e.g. text, audio, image, video) and lists of ProgIDs (e.g. txtfile, > mp3file, jpegfile, mpegfile) either in a file's extended attributes > (EAs) or an alternate data stream. I think OS/2 used EAs to store file > associations. It's too bad NT's FAT32 doesn't support EAs (unlike > FAT16 on NT, which needed them for the OS/2 subsystem) or alternate > data streams. So an unobtrusive, decentralized approach that works > automatically with existing backup software isn't feasible with FAT32 > drives. Yeah, EAs were used for custom file associations and the "use that one as the default for this file" custom default. But honestly, who cares about FAT32? If the means of achieving this requires a better file system, eg NTFS or ext4, that's not much of a cost. > That said, I don't see this feature as being very useful compared to > just using "open with" when I occasionally need to open a file with a > non-default program. I used to often have a text executable associated with two or three things - "run", an editor, and maybe some ancillary tool like CASBuild. All files of that type would be associated with the same three targets, but for one, I might have double click do a regular run, but for another, I might always want it to go to CASBuild. Or perhaps a GUI application might be associated with the VX-REXX "run script" launcher rather than the regular console. A Windows equivalent would be to have a .py file associated normally with the regular console, but some individual ones associated with pythonw.exe - without renaming them to .pyw. AFAIK there is no way to do this on Windows short of renaming the files. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Tue, Dec 12, 2017 at 3:30 PM, Chris Angelico wrote: > On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson > wrote: >> Chris Angelico wrote: >> >>> Which is why OS/2, back in the 1990s, had *multiple* >>> associations for any given file. You could use file types >>> (sadly not MIME types - this was before MIME was the one >>> obvious standard to use) to identify *any number* of >>> programs that are likely to be used with a file, and then >>> one of them is the global default. For any specific file, >>> you can change which program is its own default, and even >>> add specific associations for that individual file. When >>> you double-click, you get the default; if you right-click >>> and choose "Open", you could pick from the associated >>> programs. A good system, and one that I still haven't seen >>> replicated in a mainstream OS. >> >> Windows has the same features. > > It does? Show me how to specify that one file - which might have the > exact same name as many similar files - should be associated with a > different program than the one its name would normally suggest. Show > me how to identify multiple file types for a given file, independently > of its filename. AFAIK that's not currently possible in Windows -- at least not without writing a custom shell extension. Hypothetically, the shell could support something like this on NTFS drives by storing a perceived type (e.g. text, audio, image, video) and lists of ProgIDs (e.g. txtfile, mp3file, jpegfile, mpegfile) either in a file's extended attributes (EAs) or an alternate data stream. I think OS/2 used EAs to store file associations. It's too bad NT's FAT32 doesn't support EAs (unlike FAT16 on NT, which needed them for the OS/2 subsystem) or alternate data streams. So an unobtrusive, decentralized approach that works automatically with existing backup software isn't feasible with FAT32 drives. That said, I don't see this feature as being very useful compared to just using "open with" when I occasionally need to open a file with a non-default program. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Tue, 12 Dec 2017 05:52:41 -0800, Rick Johnson wrote: > Rustom Mody wrote: >> This thread is getting like a mini hologram of our current surreal time >> If we can put aside who is right and wrong for a moment we see the >> more frightening spectacle that Repubs and democrats, Remainers and >> Brexiters and so on all over by getting more and more shrill are not >> talking to each other but past each other > > I blame the confirmation bias of social media for the current state of > dissed-discourse we find ourselves in these days. > >> > [Rick Johnson wrote] >> > A file with no extension (regardless of the OS or desktop enviroment >> > that it was created on), is like a sealed box with no label to >> > indicate the contents. >> >> So to Rick: Not if you use something like file (magic) My (unschooled) >> estimate is it gets its detection right 80% of the time > > But this suggestion misses my point entirely. And the point is, we > shouldn't have to pick-up the "box" (aka: file) and shake it (ook-ook) > just to "intuit" what is inside. Using file extentions (aka: labels) > solves this semantical problem much more elegantly. Now, is a perfect > solution? Of course not! However, it is the most practical solution. > >> And to Chris and others who think file(magic) is a replacement for >> file-associations. Even assuming that magic works 100% : >> Say I have an html file. >> That means its ALSO a text file. >> So its equally legitimate to set defaults to use: >> - a plain text editor (of which there are hundreds) >> - to open it in browser of choice (also plural nowadays) >> - some sort of html composer - etc >> >> Which means we are beyond the nature of the file per se to the pattern >> of its usage > > And although an automated "intuitor" could easily determine if a file > contained a markup language, we would still be force to "shake the box" > by running it. Back to the original problem has the execute bit been set on the file? -- All Hell hadn't been let loose. It was merely Detritus. But from a few feet away you couldn't tell the difference. (The Fifth Elephant) -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson wrote: > Chris Angelico wrote: > > [...] > >> > Yeah… magic… in the category of mind-reading? sooth- >> > saying? >> >> Which is why OS/2, back in the 1990s, had *multiple* >> associations for any given file. You could use file types >> (sadly not MIME types - this was before MIME was the one >> obvious standard to use) to identify *any number* of >> programs that are likely to be used with a file, and then >> one of them is the global default. For any specific file, >> you can change which program is its own default, and even >> add specific associations for that individual file. When >> you double-click, you get the default; if you right-click >> and choose "Open", you could pick from the associated >> programs. A good system, and one that I still haven't seen >> replicated in a mainstream OS. > > Windows has the same features. It does? Show me how to specify that one file - which might have the exact same name as many similar files - should be associated with a different program than the one its name would normally suggest. Show me how to identify multiple file types for a given file, independently of its filename. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
Rustom Mody wrote: > This thread is getting like a mini hologram of our current > surreal time If we can put aside who is right and wrong > for a moment we see the more frightening spectacle that > Repubs and democrats, Remainers and Brexiters and so on all > over by getting more and more shrill are not talking to > each other but past each other I blame the confirmation bias of social media for the current state of dissed-discourse we find ourselves in these days. > > [Rick Johnson wrote] > > A file with no extension (regardless of the OS or desktop > > enviroment that it was created on), is like a sealed box > > with no label to indicate the contents. > > So to Rick: Not if you use something like file (magic) My > (unschooled) estimate is it gets its detection right 80% of > the time But this suggestion misses my point entirely. And the point is, we shouldn't have to pick-up the "box" (aka: file) and shake it (ook-ook) just to "intuit" what is inside. Using file extentions (aka: labels) solves this semantical problem much more elegantly. Now, is a perfect solution? Of course not! However, it is the most practical solution. > And to Chris and others who think file(magic) is a > replacement for file-associations. Even assuming that magic > works 100% : > Say I have an html file. > That means its ALSO a text file. > So its equally legitimate to set defaults to use: > - a plain text editor (of which there are hundreds) > - to open it in browser of choice (also plural nowadays) > - some sort of html composer > - etc > > Which means we are beyond the nature of the file per se to > the pattern of its usage And although an automated "intuitor" could easily determine if a file contained a markup language, we would still be force to "shake the box" by running it. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
Chris Angelico wrote: [...] > > Yeah… magic… in the category of mind-reading? sooth- > > saying? > > Which is why OS/2, back in the 1990s, had *multiple* > associations for any given file. You could use file types > (sadly not MIME types - this was before MIME was the one > obvious standard to use) to identify *any number* of > programs that are likely to be used with a file, and then > one of them is the global default. For any specific file, > you can change which program is its own default, and even > add specific associations for that individual file. When > you double-click, you get the default; if you right-click > and choose "Open", you could pick from the associated > programs. A good system, and one that I still haven't seen > replicated in a mainstream OS. Windows has the same features. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Tue, Dec 12, 2017 at 12:37 PM, Rustom Mody wrote: > > This thread is getting like a mini hologram of our current surreal time… > If we can put aside who is right and wrong for a moment we see the more > frightening spectacle that Repubs and democrats, Remainers and Brexiters and > so > on all over — by getting more and more shrill are not talking to each other > but > past each other > > So… > > On Tuesday, December 12, 2017 at 2:45:32 AM UTC+5:30, Rick Johnson wrote: >> Rustom Mody wrote: >> >> [...] >> >> > 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 >> >> A file with no extension (regardless of the OS or desktop enviroment that it >> was created on), is like a sealed box with no label to indicate the contents. > > So to Rick: > > Not if you use something like file (magic) > My (unschooled) estimate is it gets its detection right 80% of the time > > And to Chris and others who think file(magic) is a replacement for > file-associations. Even assuming that magic works 100% : > > Say I have an html file. > That means its ALSO a text file. > So its equally legitimate to set defaults to use… > - a plain text editor (of which there are hundreds) > - to open it in browser of choice (also plural nowadays) > - some sort of html composer > - etc > > Which means we are beyond the nature of the file per se to the pattern of its > usage > > Yeah… magic… in the category of mind-reading? sooth-saying? Which is why OS/2, back in the 1990s, had *multiple* associations for any given file. You could use file types (sadly not MIME types - this was before MIME was the one obvious standard to use) to identify *any number* of programs that are likely to be used with a file, and then one of them is the global default. For any specific file, you can change which program is its own default, and even add specific associations for that individual file. When you double-click, you get the default; if you right-click and choose "Open", you could pick from the associated programs. A good system, and one that I still haven't seen replicated in a mainstream OS. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
This thread is getting like a mini hologram of our current surreal time… If we can put aside who is right and wrong for a moment we see the more frightening spectacle that Repubs and democrats, Remainers and Brexiters and so on all over — by getting more and more shrill are not talking to each other but past each other So… On Tuesday, December 12, 2017 at 2:45:32 AM UTC+5:30, Rick Johnson wrote: > Rustom Mody wrote: > > [...] > > > 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 > > A file with no extension (regardless of the OS or desktop enviroment that it > was created on), is like a sealed box with no label to indicate the contents. So to Rick: Not if you use something like file (magic) My (unschooled) estimate is it gets its detection right 80% of the time And to Chris and others who think file(magic) is a replacement for file-associations. Even assuming that magic works 100% : Say I have an html file. That means its ALSO a text file. So its equally legitimate to set defaults to use… - a plain text editor (of which there are hundreds) - to open it in browser of choice (also plural nowadays) - some sort of html composer - etc Which means we are beyond the nature of the file per se to the pattern of its usage Yeah… magic… in the category of mind-reading? sooth-saying? -- 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)
Lawrence D’Oliveiro wrote: > Rick Johnson wrote: > > And it's not like we can just pick file up and shake > > it, in a crude attempt to intuit the contents. > > Yes we can! BO??? Is that you? -- 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)
On Mon, Dec 11, 2017 at 2:35 PM, Steve D'Aprano wrote: > On Mon, 11 Dec 2017 11:29 am, Chris Angelico wrote: > >> On Mon, Dec 11, 2017 at 10:10 AM, Rick Johnson >> wrote: > >>> And it's not like we can just pick file up and shake >>> it, in a crude attempt to intuit the contents. >> >> No, but fortunately we have magic. And magic can tell us a lot about >> what a file contains. >> >> man 5 magic > > https://pypi.python.org/pypi/python-magic > Yep, that's an interface to the same magic I'm talking about. Wands, scrolls, incantations, they're all just front ends to libmagic. 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)
On Mon, 11 Dec 2017 11:29 am, Chris Angelico wrote: > On Mon, Dec 11, 2017 at 10:10 AM, Rick Johnson > wrote: >> And it's not like we can just pick file up and shake >> it, in a crude attempt to intuit the contents. > > No, but fortunately we have magic. And magic can tell us a lot about > what a file contains. > > man 5 magic https://pypi.python.org/pypi/python-magic -- 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)
On Mon, Dec 11, 2017 at 10:10 AM, Rick Johnson wrote: > Rustom Mody wrote: > > [...] > >> 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 > > A file with no extension (regardless of the OS or desktop > enviroment that it was created on), is like a sealed box with > no label to indicate the contents. > > And it's not like we can just pick file up and shake > it, in a crude attempt to intuit the contents. No, but fortunately we have magic. And magic can tell us a lot about what a file contains. man 5 magic 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)
Rustom Mody wrote: [...] > 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 A file with no extension (regardless of the OS or desktop enviroment that it was created on), is like a sealed box with no label to indicate the contents. And it's not like we can just pick file up and shake it, in a crude attempt to intuit the contents. >>> box.shake(ms=1000, aggression=0.1, log=sys.stdout) Hiss "What was that?" o_O >>> box.shake(ms=3000, aggression=0.9, log=sys.stdout) Reeoooww! Hi! Hiss! "Holy crap! O_O "Grandma must have gift-wrapped the cat again!" Granted, the label could be an outright lie or mistake. However, we can safely assume that outright lies, mistakes, and even gift-wrapped cats, will be the minority. The vast majority of file extensions we encounter will be truthful reflections of the contents. Unless we're paranoid, of course. But that's another issue entirely... Our DEs can deal with lies and mismarked labels on a case by case basis. -- 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)
On 10/12/17 07:01, Chris Angelico wrote: > 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. Indeed, VNC pulls in X11: https://packages.ubuntu.com/xenial/vnc4server If you're interested in what the bare-bones Ubuntu server install contains, you can look it up here: https://packages.ubuntu.com/xenial/ubuntu-server In other news: in case you hadn't heard, Mir is dead. Mark Shuttleworth killed it this summer. -- 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)
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? Anyhow, your first part is > correct: without a GUI, you can't exactly double-click on a file. > You'd have to install 'ubuntu server' to get an Ubuntu without a GUI, -- Chris Green · -- 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)
On Sunday, December 10, 2017 at 11:15:15 AM UTC+5:30, Frank Millman wrote: > "Rustom Mody" wrote in message > > > > 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'. Inspired by this thread, I added alias o="xdg-open" to my ~/.bash_aliases And as best as I can see, now $ o foo.png $ o bar.mp3 $ o baz.pdf and $ o http://python.org all do the “Right Thing” My main attraction for this is that I often end up doing evince foo.png instead of eog foo.png The one thing that does not work (yet) is $ o foo.py starts up gedit (instead of emacs) PS. As it happens I had figured out something for my students some years ago: https://bitbucket.org/rustom/vit-projects/wiki/emacsasdefault I’ll have to reread and recheckout what I wrote back then 😉 -- 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)
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
Re: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)
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)
"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)
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)
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)
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)
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)
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: Please tell me how to execute python file in Ubuntu by double clicking on file. (Posting On Python-List Prohibited)
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)
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 click
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: Please tell me how to execute python file in Ubuntu by double click
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: Please tell me how to execute python file in Ubuntu by double click
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
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? -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Monday, December 4, 2017 at 3:49:11 AM UTC-6, dhananjays...@gmail.com wrote: > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when > i am double click in python program (Dhananjay.py),it is > opening in Text Editor by Default in Ubuntu.I want to run > this program when i double click on it as any *.Exe file > executes as in Window. Sir please help me. Sounds like your OS file associations are all botched-up and the ".py" extention has been linked (either by you purposefully, as a system default, or as the side-effect of something else) to a texteditor program. It's easy enough to change this setting in the OS, and i believe there is a Python module or two for the task -- if that's your cup-o-tea. Granted, opening a text editor for unknown files is always a wise default system setting as it avoids any exploits that may be initiated by a hapless neophyte. Take, for example, the braindead Windozes default setting for autorun, which has been the source of many nasty exploits. I suppose that Gates figures his user base is so dumb that they can't even find the My Computer icon and double click it in order to access the contents of a removable drive, CD-ROM, or whatever STD riddled device they happen to plug in. The wise windoze user knows that disabling autorun is paramount to ensuring a secure experience, among other braindead defaults. This is not really a "python" question, and is actually generally applicable to Operating Systems. And the solution is specific to each platform. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On 2017-12-04 10:48, dhananjaysingh091...@gmail.com wrote: > Respected Sir/Mam, > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am double click in python program (Dhananjay.py),it is opening in Text Editor by Default in Ubuntu.I want to run this program when i double click on it as any *.Exe file executes as in Window. > Sir please help me. > https://askubuntu.com/a/544544 -- Thomas Jollans -- 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)
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... -- 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)
On Wednesday, December 6, 2017 at 8:29:23 PM UTC-6, Steve D'Aprano wrote: [...] > If the term "OS file associations" is ever so slightly > inaccurate (it's not the actual OS kernel that does the > associating, but the desktop environment), well, we can > probably say the same thing about Mac OS X and maybe even > Windows itself. I don't believe many folks think about the OS in the strictly narrow view that it is "only a kernel existing below higher abstractions", as much as they accept the OS as encompassing the OS kernel and all the ooey and gooey interfacing layers on top. I suppose you might call that a "system", but such a word is far too ambiguous. IOWs: it may not be technically correct, but it is the accepted norm. -- 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)
On Thu, Dec 07, 2017 at 01:29:11PM +1100, Steve D'Aprano wrote: > 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). We _can_ go one level below that: mailcap is independant of the desktop environment, it does associate file (content) types with suitable (hopefully) applications. The one thing it doesn't "do" that's relevant to OPs post is that it doesn't react to clicks or taps in order to _execute_ those associations. Best, Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 -- 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)
On Thu, 7 Dec 2017 08:22 am, Python wrote: > On Wed, Dec 06, 2017 at 10:35:58AM +1100, 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? > > 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). Lawrence is showing off his geek cred with an answer that is pedantically correct but in practice not just useless but actually false. Of course Linux computers can associate certain files with certain applications. If the term "OS file associations" is ever so slightly inaccurate (it's not the actual OS kernel that does the associating, but the desktop environment), well, we can probably say the same thing about Mac OS X and maybe even Windows itself. > How it knows indeed > depends on the context of the click, what desktop environment you're > using, what application(s) you're using, and what configurations > you've made to those things to address any file associations. Indeed you are correct, which is why it may not be a trivial matter to answer the OP's question about how to get the behaviour he wants. But that isn't what my comment is about. I'm simply replying to Lawrence's insinuation that Linux computers don't associate file types to applications. I'm sure that Lawrence worded his statement *ever so carefully* to ensure that it was pedantically correct if read to the letter, while still insinuating something completely wrong. It takes a lot of care to provide information which is both true and utterly misleading at the same time, but Lawrence does it very, very well indeed. If only he would use his considerable intellect to provide *useful* answers instead of *accurate but misleading* answers. -- 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)
On Wed, Dec 06, 2017 at 10:35:58AM +1100, 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? The answer to that is (sadly) complicated. How it knows indeed depends on the context of the click, what desktop environment you're using, what application(s) you're using, and what configurations you've made to those things to address any file associations. There isn't one answer. On the same system, the answer could well be completely different for any two users, or even for the same user, given different application contexts. The latter is less true than it used to be, but still true nonetheless. Granted, this isn't a very useful answer, but it's the only one you can give that is certainly correct, without more context. -- 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)
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? -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double clicking on file.
On Monday, December 4, 2017 at 4:49:11 AM UTC-5, dhananjays...@gmail.com wrote: > Respected Sir/Mam, > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am > double click in python program (Dhananjay.py),it is opening in Text Editor by > Default in Ubuntu.I want to run this program when i double click on it as any > *.Exe file executes as in Window. > Sir please help me. Make the first line oh the file: #!/usr/bin/env python Then chmod it with executable permissions: chmod +x Dhananjay.py Then you can double-click to run it. -- 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)
On Tuesday, December 5, 2017 at 2:58:44 AM UTC-6, 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". True. But i'm not convinced that file associations are really all that terrible of a thing. What do you think? Though, Micheal Torrie did raise a valid point regarding the pitfalls of those who rely too heavily on the X-Windows mouse event, warning that -- paraphrasing here -- "You don't want to invoke a python script with a double-click as you will not maintain control of the output stream when the program fails or quietly exits" Fair point. Although, on windows, at least, there is an option of using either a ".py" file extension or a ".pyw" file extension for your scripts, such that, when invoking the script from the desktop enviroment (via double-click), the former will ensure a terminal window is displayed while the latter will suppress a terminal entirely. However, i find this design to be woefully inadequate as a "feature". Hmm, it seems this design is best described as: "a feature that wanted to be great, allbeit, one that failed _miserably_". With that in mind, a more practical implementation of "forcing" or "suppressing" terminals via file extensions would take the form of the following three alternatives: (OPTION_1): Run the script with a terminal, and autoclose upon fatal error or EOP. (".py") (OPTION_2): Run script with a terminal, but do not auto-close the terminal when Python chokes or the program exits, instead, allow the human to decide. (this will be best for debugging purposes) (".pydb" or ".pyt" or "pyl") (OPTION_3): Run the script, but suppress the terminal entirely. (".pyw") -- 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)
On Tuesday, December 5, 2017 at 2:28:44 PM UTC+5:30, 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”. From a strict pov thats right But then from a strict pov linux is not an OS, its just one component of an OS https://www.howtogeek.com/177213/linux-isnt-just-linux-8-pieces-of-software-that-make-up-linux-systems/ The more pragmatic answer to this question is to run $ man xdg-mime $ man xdg-open etc (terrible documentation like everything else gnome… but thats another story) -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double clicking on file.
On 05/12/17 01:03, Michael Torrie wrote: > On 12/04/2017 04:49 AM, Thomas Jollans wrote: >> On 2017-12-04 10:48, dhananjaysingh091...@gmail.com wrote: >>> Respected Sir/Mam, >>> I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am >>> double click in python program (Dhananjay.py),it is opening in Text Editor >>> by Default in Ubuntu.I want to run this program when i double click on it >>> as any *.Exe file executes as in Window. >>> Sir please help me. >>> >> >> https://askubuntu.com/a/544544 > > Oops! You misread his question. The question was, how can he run a > python script by simply double clicking on it in the file browser in > Ubuntu? No, I was just being (rudely, perhaps) terse. The file browser used by default in Ubuntu/Gnome (aka Nautilus) has a setting, as described in that Ask Ubuntu answer, that makes it execute scripts, Python or otherwise, on double click (as long as they have a correct #! line and are executable) > > Now I don't know the answer to that question, but I can say that nearly > all the time you just don't want to do that anyway, for reasons I state > below. I absolutely agree. > > Instead, open a terminal, change to the directory where you python > script is and either run it directly (if it's chmod'd as exectuable) > using "./myscript.py" or use the python interpreter: "python3 > /path/to/myscript.py" > > The reason scripts are rarely launched from the file browser like you > want to do is that often scripts communicate with the user via standard > out, so you need to run them from a terminal. > > There are some GUI programs written in Python, but those are usually > launched from a .desktop file shortcut. > > > -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double clicking on file.
On 12/04/2017 04:49 AM, Thomas Jollans wrote: > On 2017-12-04 10:48, dhananjaysingh091...@gmail.com wrote: >> Respected Sir/Mam, >> I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am >> double click in python program (Dhananjay.py),it is opening in Text Editor >> by Default in Ubuntu.I want to run this program when i double click on it as >> any *.Exe file executes as in Window. >> Sir please help me. >> > > https://askubuntu.com/a/544544 Oops! You misread his question. The question was, how can he run a python script by simply double clicking on it in the file browser in Ubuntu? Now I don't know the answer to that question, but I can say that nearly all the time you just don't want to do that anyway, for reasons I state below. Instead, open a terminal, change to the directory where you python script is and either run it directly (if it's chmod'd as exectuable) using "./myscript.py" or use the python interpreter: "python3 /path/to/myscript.py" The reason scripts are rarely launched from the file browser like you want to do is that often scripts communicate with the user via standard out, so you need to run them from a terminal. There are some GUI programs written in Python, but those are usually launched from a .desktop file shortcut. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double clicking on file.
On Monday, December 4, 2017 at 3:49:11 AM UTC-6, dhananjays...@gmail.com wrote: > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when > i am double click in python program (Dhananjay.py),it is > opening in Text Editor by Default in Ubuntu.I want to run > this program when i double click on it as any *.Exe file > executes as in Window. Sir please help me. Sounds like your OS file associations are all botched-up and the ".py" extention has been linked (either by you purposefully, as a system default, or as the side-effect of something else) to a texteditor program. It's easy enough to change this setting in the OS, and i believe there is a Python module or two for the task -- if that's your cup-o-tea. Granted, opening a text editor for unknown files is always a wise default system setting as it avoids any exploits that may be initiated by a hapless neophyte. Take, for example, the braindead Windozes default setting for autorun, which has been the source of many nasty exploits. I suppose that Gates figures his user base is so dumb that they can't even find the My Computer icon and double click it in order to access the contents of a removable drive, CD-ROM, or whatever STD riddled device they happen to plug in. The wise windoze user knows that disabling autorun is paramount to ensuring a secure experience, among other braindead defaults. This is not really a "python" question, and is actually generally applicable to Operating Systems. And the solution is specific to each platform. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double clicking on file.
On 2017-12-04 10:48, dhananjaysingh091...@gmail.com wrote: > Respected Sir/Mam, > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am > double click in python program (Dhananjay.py),it is opening in Text Editor by > Default in Ubuntu.I want to run this program when i double click on it as any > *.Exe file executes as in Window. > Sir please help me. > https://askubuntu.com/a/544544 -- Thomas Jollans -- https://mail.python.org/mailman/listinfo/python-list