BartC wrote:
Which means that input of A B* *C will all end up running together so
that you have no idea what is what or which file corresponds to which
expansion.
So if you intend your program to be used on unix, you
need to design it so that it doesn't depend on such
distinctions.
Now the p
On 12/07/2016 11:26 PM, Gregory Ewing wrote:
> BartC wrote:
>> println dirlist(cmdparams[2])# Windows
>> println tail(cmdparams) # Linux
>
> I'm not familiar with your language, so I'll reply
> in Python. If you write it like this:
>
> for arg in sys.argv[1:]:
>
BartC wrote:
println dirlist(cmdparams[2])# Windows
println tail(cmdparams) # Linux
I'm not familiar with your language, so I'll reply
in Python. If you write it like this:
for arg in sys.argv[1:]:
for name in glob(arg):
print(name)
then the user will
BartC wrote:
Only the tiny minority that can be meaningfully invoked on an arbitrary
number of files at the same time.
Um... you mean the "tiny minority" that includes just
about *every* unix utility that operates on files?
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
BartC wrote:
And globbing doesn't take care of all of it: a Linux program still has
to iterate over a loop of filenames. The same as on Windows, except the
latter will need to call a function to deliver the next filename.
Actually, most of them will require *two* loops, one to
iterate over a s
On 12/07/2016 11:09 PM, 3dB wrote:
> trying to install SpeechRecognition for Python results in error:
>
> running install_lib
> creating /Library/Python/2.7/site-packages/speech_recognition
> error: could not create
> '/Library/Python/2.7/site-packages/speech_recognition': Permission deni
Paul Moore wrote:
On Tuesday, 6 December 2016 21:44:18 UTC, Gregory Ewing wrote:
What you need to understand is that, to a Unix user, * and ? are *just as
well known* as |, < and >.
And to Windows users. Just because BartC is proposing a silly distinction
between what "Unix users" and "Windo
trying to install SpeechRecognition for Python results in error:
running install_lib
creating /Library/Python/2.7/site-packages/speech_recognition
error: could not create
'/Library/Python/2.7/site-packages/speech_recognition': Permission denied
Any advice on how to fix?
Follow informat
Steve D'Aprano wrote:
I don't know any Unix programs that provide
file spec processing.
'find' does, but only for its -name argument, and only because
it does something different with it from what the shell would
do. And you do need to quote it if it contains glob characters.
--
Greg
--
https:
On Thursday 08 December 2016 02:17, Rustom Mody wrote:
> Trying to write some code using sets (well frozen sets)
> And was hit by this anomaly
>
> This is the behavior of lists I analogously expect in sets:
>
[]
> []
[[]]
> [[]]
>
> ie the empty list and the list of the empty li
On Thursday 08 December 2016 03:15, DFS wrote:
> dts= ['10-Mar-1998',
> '20-Aug-1997',
> '06-Sep-2009',
> '23-Jan-2010',
> '12-Feb-2010',
> '05-Nov-2010',
> '03-Sep-2009',
> '07-Nov-2014',
> '08-Mar-2013']
>
> Of course, the naive:
On Thursday 08 December 2016 12:15, BartC wrote:
> On 08/12/2016 00:09, Steve D'Aprano wrote:
>> On Thu, 8 Dec 2016 02:48 am, BartC wrote:
>
>>> You make it sound like a big deal. Here's a program (in my language not
>>> Python) which prints the list of files matching a file-spec:
>>>
>>> println
I was just made aware of a very interesting ORM project that has been
around since about 2013, while listening to a recent episode of the Talk
Python To Me podcast. The idea of using generators to build queries is
really cool. I'm sure PonyORM has its limitations and drawbacks, as all
ORM models
On Thursday 08 December 2016 11:34, BartC wrote:
> On 07/12/2016 23:35, Steve D'Aprano wrote:
>> On Thu, 8 Dec 2016 02:19 am, BartC wrote:
>>
>>> On 07/12/2016 14:34, Steve D'Aprano wrote:
>> [...]
I don't know why you are so hung up over the number of characters here,
or this bogeyman o
On 08/12/2016 00:09, Steve D'Aprano wrote:
On Thu, 8 Dec 2016 02:48 am, BartC wrote:
You make it sound like a big deal. Here's a program (in my language not
Python) which prints the list of files matching a file-spec:
println dirlist(cmdparams[2])
Does dirlist provide an escaping mechanism
On Thu, Dec 8, 2016 at 10:35 AM, Steve D'Aprano
wrote:
> In the Unix world, I'm at the mercy of *one* program, the shell. In your
> ideal world, I'm at the mercy of EVERY program that implements globbing:
> each and every one has to independently offer a way to disable their own
> internal globbin
On 07/12/2016 23:35, Steve D'Aprano wrote:
On Thu, 8 Dec 2016 02:19 am, BartC wrote:
On 07/12/2016 14:34, Steve D'Aprano wrote:
[...]
I don't know why you are so hung up over the number of characters here,
or this bogeyman of "one million files" in a directory.
Because /you/ brought it up a
On Thu, 8 Dec 2016 07:01 am, Skip Montanaro wrote:
> Some things are better just left alone. File globbing is probably one
> of those things. There's no right answer, and the people in the two
> camps will never come to a compromise.
Be fair Skip, we've already repeatedly acknowledged that the Un
On Thu, 8 Dec 2016 02:48 am, BartC wrote:
> On 07/12/2016 13:58, Dennis Lee Bieber wrote:
>> On Wed, 7 Dec 2016 11:54:35 +, BartC declaimed the
>> following:
>>
>>> With automatic expansion, then EVERY program can become dangerous. Can
>>> no one else see this?
>>>
>>
>> With your scheme, EVE
On Thu, 8 Dec 2016 02:19 am, BartC wrote:
> On 07/12/2016 14:34, Steve D'Aprano wrote:
[...]
>> I don't know why you are so hung up over the number of characters here,
>> or this bogeyman of "one million files" in a directory.
>
> Because /you/ brought it up as a reason why 'globbing' would help
BartC writes:
> On 07/12/2016 15:25, Ben Bacarisse wrote:
>> BartC writes:
>>
>>> [...] But remember:
>>>
>>> cp *.c
>>>
>>> There might be some irate users out there if it can't detect a simple
>>> user error like that.
>>
>> There might be. They are ill-served by current Unix shells. But,
On Thu, Dec 8, 2016 at 7:17 AM, eryk sun wrote:
> On Wed, Dec 7, 2016 at 12:39 PM, Chris Angelico wrote:
>> Note that two of the Beauty Stone tracks include quotes as well as
>> question marks. How do you identify those? Let's say you want to play
>> one of these in VLC, and then maybe you decide
Op 07-12-16 om 19:02 schreef BartC:
> On 07/12/2016 16:53, Michael Torrie wrote:
>> On 12/07/2016 08:48 AM, BartC wrote:
>>> I would prefer that the program "t" can be invoked exactly the same way
>>> under both systems. I don't want different instructions for Linux, or
>>> for the user (of my lang
On Wednesday December 7 2016 14:57, in comp.lang.python, "BartC"
wrote:
> On 07/12/2016 18:02, BartC wrote:
>
>> If I want to run a Windows program on Linux, and that program needs to
>> see *.* unexpanded, then it can't undo that expansion. The cat is
>> already out of the bag.
>
> I mean, the
On Wed, Dec 7, 2016 at 12:39 PM, Chris Angelico wrote:
> Note that two of the Beauty Stone tracks include quotes as well as
> question marks. How do you identify those? Let's say you want to play
> one of these in VLC, and then maybe you decide that the track in
> Pirates of Penzance/MusicOnly is
On 07/12/2016 18:02, BartC wrote:
If I want to run a Windows program on Linux, and that program needs to
see *.* unexpanded, then it can't undo that expansion. The cat is
already out of the bag.
I mean, the genie is out of the bottle, whatever. You know what I mean,
the operation is not rever
On Wed, Dec 7, 2016 at 12:17 PM, Anton Mamaenko wrote:
> Wow... this thread gets to finally become a holy war.
It's not like this particular holy war is new, either. I'm sure it was
beaten to death in the days before Windows was a thing. As I indicated
in an earlier note, VMS and Unix did command
This might be totally irrelevant, but, if (a) the data to be read by the
program during a given run is known when the program is run/launched, (b)
that data is purely textual and (c) that data can be read by the program
from the stdin channel, then my idea is (1) before the launch, put that
data in
On 07/12/2016 15:25, Ben Bacarisse wrote:
BartC writes:
[...] But remember:
cp *.c
There might be some irate users out there if it can't detect a simple
user error like that.
There might be. They are ill-served by current Unix shells. But,
oddly, the flow has gone the other way. Peopl
On 2016-12-07 15:33, Ned Batchelder wrote:
On Wednesday, December 7, 2016 at 10:18:32 AM UTC-5, Rustom Mody wrote:
Trying to write some code using sets (well frozen sets)
And was hit by this anomaly
This is the behavior of lists I analogously expect in sets:
>>> []
[]
>>> [[]]
[[]]
>>>
ie the
On 12/07/2016 10:59 AM, John Gordon wrote:
> In Karim Farokhnia
> writes:
>
>> Hi there,
>
>> I am writing a batch file in Python. The batch file, in part, calls a
>> program named "oq-console.bat" to run. Then once the program comes up
>> (it looks like windows CMD), I need the batch file to
Wow... this thread gets to finally become a holy war. One method is dealing
with this is take the environment as granted (Windows/Unix/Linux/MacOS/Dos
sucks while my
Windows/Unix/Linux/MacOS/Dos is the best) and figure if the hassle of porting
(time, tech, AND moral) worth it. He just "do not
On 07/12/2016 16:53, Michael Torrie wrote:
On 12/07/2016 08:48 AM, BartC wrote:
I would prefer that the program "t" can be invoked exactly the same way
under both systems. I don't want different instructions for Linux, or
for the user (of my language) to have to write two lots of code, as that
i
In Karim Farokhnia
writes:
> Hi there,
> I am writing a batch file in Python. The batch file, in part, calls a
> program named "oq-console.bat" to run. Then once the program comes up
> (it looks like windows CMD), I need the batch file to type some commands
> to make it run (just like I would
On 12/07/2016 10:43 AM, Karim Farokhnia wrote:
>> Is the program that oq-console.bat runs interactive? After it
>> launches into its own console window it asks for more input?
> The program doesn't ask for more input parameters as all parameters
> are in input files and the program will automatica
On Wednesday, December 7, 2016 at 12:18:51 PM UTC-5, Michael Torrie wrote:
> On 12/07/2016 09:38 AM, Karim Farokhnia wrote:
> > I am writing a batch file in Python. The batch file, in part, calls a
> > program named "oq-console.bat" to run. Then once the program comes up
> > (it looks like windows
On Dec 7, 2016 11:40 AM, "Karim Farokhnia"
wrote:
>
> Hi there,
>
> I am writing a batch file in Python. The batch file, in part, calls a
program named "oq-console.bat" to run. Then once the program comes up (it
looks like windows CMD), I need the batch file to type some commands to
make it run (j
On Wed, Dec 7, 2016 at 8:50 AM, Skip Montanaro
wrote:
> PyPI came back. A bit more sleuthing suggests that the
> websocket-client package on PyPI is Ohtani's package, and is more
> up-to-date than the copyright notices would suggest. The package was
> updated a few days ago on GitHub.
>
> Taking
On 12/07/2016 07:57 AM, BartC wrote:
> I don't follow you. "?" is problematical on both systems. I think
> Windows disallows it completely: I get 'Protocol error' if I copy such a
> file from Linux to Windows. Presumably there is an escaping system, but
> I don't know what it is.
As Chris says,
On 12/07/2016 09:38 AM, Karim Farokhnia wrote:
> I am writing a batch file in Python. The batch file, in part, calls a
> program named "oq-console.bat" to run. Then once the program comes up
> (it looks like windows CMD), I need the batch file to type some
> commands to make it run (just like I wou
On Wed, Dec 7, 2016 at 1:08 AM, wrote:
> Thank you Justin,
>
> I'm on the dev server and should present results in this way.
>
> Yes, I use manage.py runserver --insecure to start the server (from
> PyCharm).
>
> My views.py call:
>
> @detail_route(methods=['post'], permission_classes=[permission
On 12/07/2016 08:48 AM, BartC wrote:
> I would prefer that the program "t" can be invoked exactly the same way
> under both systems. I don't want different instructions for Linux, or
> for the user (of my language) to have to write two lots of code, as that
> is my job...
Ahh now we come to the
PyPI came back. A bit more sleuthing suggests that the
websocket-client package on PyPI is Ohtani's package, and is more
up-to-date than the copyright notices would suggest. The package was
updated a few days ago on GitHub.
Taking the path of least resistance (no changes necessary to the
code), I
Hi there,
I am writing a batch file in Python. The batch file, in part, calls a program
named "oq-console.bat" to run. Then once the program comes up (it looks like
windows CMD), I need the batch file to type some commands to make it run (just
like I would do it by myself).
I need the batch f
On 12/07/2016 07:58 AM, Marko Rauhamaa wrote:
> Steve D'Aprano :
>
>> I don't know any Unix programs that provide file spec processing.
>> (That's not to say that there are absolutely none, only that I don't
>> know of any.)
>
> I can think of "find", "git" and "scp".
>
> Git supports the recurs
I've recently inherited a small bit of code which uses websockets. I think
the package it uses is Horoki Ohtani's package dating from 2010. I have v.
0.34.0. Looking on PyPI, I see another websocket package (not Ohtani's)
with a version of 0.2.1 (also dating from 2010, I believe).
These two packag
On Thu, Dec 8, 2016 at 2:19 AM, BartC wrote:
> OK, but you go first: how does a Linux program tell the difference between:
>
> A B C
>
> which signifies three files, and:
>
> A B C
>
> which means two files, and an option C? And without using escapes!
The option would be called "-C", which me
On Thu, Dec 8, 2016 at 1:57 AM, BartC wrote:
> On 07/12/2016 12:39, Chris Angelico wrote:
>>
>> On Wed, Dec 7, 2016 at 10:54 PM, BartC wrote:
>>>
>>> But if a program existed that took N filename parameters with the purpose
>>> of
>>> deleting each of them, then it can't tell if they were typed i
On 07/12/2016 13:58, Dennis Lee Bieber wrote:
On Wed, 7 Dec 2016 11:54:35 +, BartC declaimed the
following:
With automatic expansion, then EVERY program can become dangerous. Can
no one else see this?
With your scheme, EVERY PROGRAM HAS TO IMPLEMENT ITS OWN GLOBBING.
Only the
Grant Edwards :
> There are a few things in Unix that are fundamentally broken and
> really just can't be used for the things they are intended for (serial
> ports come to mind).
>
> However, that doesn't seem to prevent them from having been used
> sucessfully that way way for 40 years. ;)
Sigh.
On Wednesday, December 7, 2016 at 10:18:32 AM UTC-5, Rustom Mody wrote:
> Trying to write some code using sets (well frozen sets)
> And was hit by this anomaly
>
> This is the behavior of lists I analogously expect in sets:
>
> >>> []
> []
> >>> [[]]
> [[]]
> >>>
>
> ie the empty list and the l
BartC writes:
> [...] But remember:
>
> cp *.c
>
> There might be some irate users out there if it can't detect a simple
> user error like that.
There might be. They are ill-served by current Unix shells. But,
oddly, the flow has gone the other way. People have wanted Unix shells
and utilit
On 07/12/2016 14:34, Steve D'Aprano wrote:
On Wed, 7 Dec 2016 11:23 pm, BartC wrote:
On 07/12/2016 05:15, Steven D'Aprano wrote:
On Wednesday 07 December 2016 12:55, BartC wrote:
But even Linux's 128KB will fill if someone wanted a command line that
listed 20,000 files individually. But it w
Trying to write some code using sets (well frozen sets)
And was hit by this anomaly
This is the behavior of lists I analogously expect in sets:
>>> []
[]
>>> [[]]
[[]]
>>>
ie the empty list and the list of the empty list are different things
However
(with
f= frozenset
)
>>> f()
frozenset()
>>
On Wednesday, 7 December 2016 11:55:01 UTC, BartC wrote:
> With automatic expansion, then EVERY program can become dangerous. Can
> no one else see this?
Please start an elevated command prompt on your PC, and type the command
rmdir /s /q C:\WINDOWS
There are no special characters here, so
On Tuesday, 6 December 2016 21:44:18 UTC, Gregory Ewing wrote:
> BartC wrote:
> > But those would be silly.
> >
> > Some special syntax is known about: | < and > for example. % less so
>
> What you need to understand is that, to a Unix user,
> * and ? are *just as well known* as |, < and >.
And
Steve D'Aprano :
> I don't know any Unix programs that provide file spec processing.
> (That's not to say that there are absolutely none, only that I don't
> know of any.)
I can think of "find", "git" and "scp".
Git supports the recursive "**" wildcard, as well.
Marko
--
https://mail.python.o
On 07/12/2016 12:39, Chris Angelico wrote:
On Wed, Dec 7, 2016 at 10:54 PM, BartC wrote:
But if a program existed that took N filename parameters with the purpose of
deleting each of them, then it can't tell if they were typed in individually
(so indicating a stronger intent), or whether a fing
On Tuesday, 6 December 2016 16:34:10 UTC, Michael Torrie wrote:
> On 12/06/2016 06:52 AM, BartC wrote:
> > Then you don't get utterly ridiculous and dangerous behaviour such as
> > the cp example Paul Moore came up with (that trumps most of mine actually):
>
> It's potentially dangerous agreed.
On Wed, 7 Dec 2016 11:23 pm, BartC wrote:
> On 07/12/2016 05:15, Steven D'Aprano wrote:
>> On Wednesday 07 December 2016 12:55, BartC wrote:
>>
>>> But even Linux's 128KB will fill if someone wanted a command line that
>>> listed 20,000 files individually. But it would be spectacularly bad use
>>>
On 2016-12-07, Marko Rauhamaa wrote:
> Steven D'Aprano :
>
>> Whereas if it were mandatory locking, enforced by the OS, it
>> wouldn't be a problem?
>
> The point is, the utmp scheme seems to be fundamentally broken. You
> can't use a regular file for this kind of communication.
There are a few t
On Wed, Dec 7, 2016 at 9:43 AM, Chris Angelico wrote:
> Exactly. Back in the 1990s, we had the beginnings of Windows NT, which
> was designed for servers. It had (if I recall correctly) no concept of
> file/directory permissions, little or no notion of process privilege,
> and definitely no way to
On Thu, 8 Dec 2016 12:07 am, eryk sun wrote:
>> latest step is Microsoft's partnership with Canonical (the company behind
>> Ubuntu Linux) to bring bash to Windows.
>
> The partnership with Canonical is to provide an entire Linux
> distribution, sans the kernel. The Windows Subsystem for Linux (W
Chris Angelico :
> $ find Music/ -name *\\?*
I do recommend quoting your wildcard characters.
Yet further nasty security pitfalls in bash programming:
5. Wildcards that don't match any file are left unexpanded.
6. Commands behave unexpectedly when given null lists:
$ ls a b c
a
On Wed, Dec 7, 2016 at 8:30 AM, Steven D'Aprano
wrote:
>
> There are Windows programs which understand globs, like dir. Do you honestly
> expect us to believe that it is okay to use "dir a*" on Windows because dir
> itself expands the glob, but not okay to use "dir a*" on Linux because the
> shell
On Wed, Dec 7, 2016 at 10:54 PM, BartC wrote:
> But if a program existed that took N filename parameters with the purpose of
> deleting each of them, then it can't tell if they were typed in individually
> (so indicating a stronger intent), or whether a finger slipped on a single
> filename and a
On 07/12/2016 05:15, Steven D'Aprano wrote:
On Wednesday 07 December 2016 12:55, BartC wrote:
But even Linux's 128KB will fill if someone wanted a command line that
listed 20,000 files individually. But it would be spectacularly bad use
of a command line interface which was designed for humans.
On 07/12/2016 08:30, Steven D'Aprano wrote:
On Wednesday 07 December 2016 03:41, BartC wrote:
On 06/12/2016 15:44, Michael Torrie wrote:
On 12/06/2016 04:43 AM, BartC wrote:
Yes shell expansion has it's gotchas. But those can all be learned,
Yes, learn to avoid wildcards in command param
Steven D'Aprano :
> Whereas if it were mandatory locking, enforced by the OS, it wouldn't
> be a problem?
The point is, the utmp scheme seems to be fundamentally broken. You
can't use a regular file for this kind of communication.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Dec 7, 2016 at 7:30 PM, Steven D'Aprano
wrote:
> If you accidentally say "del *" on Windows, say, when you meant "z*" for
> example, and Windows deletes all the files in the current directory, do you
> say
> to yourself...?
>
>"Thank the deities that * was expanded by the del command
On Tuesday, December 6, 2016 at 3:22:13 PM UTC+1, dr.rom...@gmail.com wrote:
> Hi,
>
> I'm facing strange Django broken pipe error (Python 2.7 on Ubuntu) that
> apparently is a not fixed Django bug. Does anybody now how to fix it? I've
> been searching a lot and didn't find any solution.
>
> Th
Steven D'Aprano wrote:
> Tell me Bart, what's the difference between these?
>
> # Linux
> rm *
>
> and
>
> # Windows
> del *
Is there an equivalent to
# touch -- -r
on Windows? Like in
$ tree
.
|-- -r
|-- a
| `-- b
| `-- c
| `-- bar.txt
`-- foo.txt
3 directories, 3 files
On Wednesday 07 December 2016 03:41, BartC wrote:
> On 06/12/2016 15:44, Michael Torrie wrote:
>> On 12/06/2016 04:43 AM, BartC wrote:
>
>> Yes shell expansion has it's gotchas. But those can all be learned,
>
> Yes, learn to avoid wildcards in command parameters at all costs. But we
> both kno
On Wednesday 07 December 2016 18:08, Marko Rauhamaa wrote:
>This is a problem with advisory locking. The fact that anyone can
>create an exclusive lock on a file they can only read! Is this
>behavior appropriate?
>
>https://www.redhat.com/archives/linux-security/1996-Novembe
>
74 matches
Mail list logo