Moi,
> Fortunately, UTF-8 has not been created the Python devs.
And there we go again, making vague statements/accusations - without
/anything/ to back it up ofcourse
Kiddo, you have posted a couple of messages now, but have said exactly
nothing. Are you sure you do not want to go into polit
Moi,
> - Today, there are still people who do not understand a
> "ÿ' can not be *safely* encoded with a single byte.
It can (and has been done for ages), just not in the character encoding
method you've choosen to use.
> - Python == Latin-1 mess (as somebody wrote on a mailing list).
Putting b
Eko,
> My test looks like this right now.
And there you have a probem, as I have no experience with what those
functions do. The below is therefore just a bit of educated guessing, so
caveat emperor.
> According to the docs PyImport_AppendInittab should be called
> before Py_Initialize
And
Eko,
> which needs also access to python3.dll but cannot load it itself as it has
> been already loaded by plugin1
>
> Is such a scenario actually possible?
Yes.
Normally a DLL can be loaded in as many processes (and threads thereof) as
you like.
However, it is possible that the DLLs initialis
DL,
>> While I agree with you there, I've been searching for other ways to
>> detect a
>> keypress (in a console-based script) and have found none.
>
> Color me disappointed!
I was disapponted too, but realized that being able to just capture any
keypress (how does the 'puter know the sc
jkn,
> I'm happy to consider the risk and choose (eg.) the hash function
> accordingly, thanks.
No problem, just wanted you to be aware and (thus) able to choose.
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
jkn,
> I think a combination of hashing the URL,
I hope you're not thinking of saving the hash (into the "done" list) instead
if the URL itself. While hash collisions do not happen often (especially
not in a small list), you cannot rule them out. And when that happens that
would mean you wo
DL,
>> Nothing that can't be countered by keeping copies of the last X number of
>> to-be-dowloaded-URLs files.
>
> That's a good idea, but how would the automated system 'know' to give-up
> on the current file and utilise generation n-1? Unable to open the file or
> ???
Well, that would be one r
Dennis,
> A full client/server RDBM should never be affected by an abort
> of a client program.
What you describe is on the single query level. What I was thinking of was
having several queries that /should/ work as a single unit, but could get
interrupted (because of the OPs ctrl-c).
Yes, C
Chris,
> Yes, and then you backpedalled furiously when I showed that
> proper transactions prevent this.
You're a fool, out for a fight.
/You/ might know exactly how to handle a database to make sure its
/transactions/ will not leave the database in a corrupt state, but as I
mentioned a few po
Chris,
>> I think that a database is /definitily/ overcomplicating stuff,
>
> Okay, sure... but you didn't say that.
I'm sorry ? In my first reply I described a file-based approach and
mentioned that the folder approach is a rather good one. What do you think
I ment there ?
> You said that
Chris,
> That's what transactions are for.
Again,
>> I guess that that went right over your head. :-)/You/ might know
>> exactly
>> what should and shouldn't be done, what makes you think the OP currently
>> does ?
> I don't understand why you're denigrating databases,
Am I denigrating a
Chris,
> Uhh
>
> Proper databases don't HAVE non-atomic operations. That's kinda their job.
Uhh... yes, /singular/ operations are considered to be atomic. A series of
operations /ment/ to be executed as a single one on the other hand aren't.
> Unless you mean that there's a non-atomic ope
jkn,
> MRAB's scheme does have the disadvantages to me that Chris has pointed
> out.
Nothing that can't be countered by keeping copies of the last X number of
to-be-dowloaded-URLs files.
As for rewriting every time, you will /have/ to write something for every
action (and flush the file!), if
"R.Wieser" wrote in message
news:r040ls$fje$1...@gioia.aioe.org...
> Hello all,
>
> I've create a treeview, and would (ofcourse) want to register some
> mouse-clicking on it, and for that I've found the ".bind()" method.
>
> https://stackoverfl
Terry,
> A physically large display should have physically larger pixels, but see
> below.
:-) Although the width of the monitor on which the default font size is
used is 47 cm and that of the TV is 81, the distance to the monitor is about
65 cm, while the distance to the TV is about 2.5 mete
MRAB,
> Huh, I never noticed that!
Yep. And as that unfolding and folding is fully done inside the treeview
widget itself there is no way you can fix it with a bit of python code. :-(
> I think it's an issue with Tk itself.
Most likely.Rather odd that that issue it still exists though. I
Hello all,
I've got a small tkinter based program showing (among others) a treeview.
I would like to set the default font for the whole window to something
larger, as its supposed to be displayed on a TV a few meters away from the
user.
A few problems:
1) I have not been able to find any info
MRAB,
> self.treeview.bind('', self.on_dclick)
That is what I used. Doubleclicking on the heading caused the "on_dclick"
code to execute, though initially the ".identify()" call in my code returns
an empty ID (no row present at the location I clicked).
That changes when the treeview contents
Hello all,
I've create a treeview, and would (ofcourse) want to register some
mouse-clicking on it, and for that I've found the ".bind()" method.
https://stackoverflow.com/questions/3794268/command-for-clicking-on-the-items-of-a-tkinter-treeview-widget
There is a slight problem with it though:
Chris,
> Yes, we know exactly how that's solved,
Nice.
> but you specifically said you weren't interested in learning.
Try taking a few courses of "understanding what you read". That is /not/
what I said.
Though it goes in par with your amadant "you're wrong" chanting, even if
there is at l
Bev,
> You acknowledge that you are new to Python, yet you claimed
> to know better than Python experts. You claim you want an answer
> and yet you purposefully ignored their response because it didn't match
> what you wanted to hear.
No, I didn't. I just pointed out that their position simply w
Greg,
> In CPython, these are the same thing. As soon as the reference
> count becomes zero, the __del__ method is called
That is what I assumed (the logical thing to do).
> *and* the object is removed from memory.
Which sounds reasonable too, especially in regard to the instances variables
ne
Antoon,
> There is a difference between not understanding why things are as
> you are told, and assuming because you don't understand, what you
> are told is wrong.
The other side is you guys, expecting from me that, even though I
appearantly do not understand it, just take whatever has being sa
Michael,
> It's a two-way street. It's hard to teach someone that won't be taught.
Whacking a student over the head because he doesn't understand has never
helped the student*. So, stop whacking and start /teaching/. Like
thinking of examples that could show the student where he goes wrong
Michael,
> You said it by implication.
>
> quote: "And as I do not think the designers of the language where that
> stupid I must therefore reject your claim to what you think happens."
I suggest you try reading that again, and imagine it being two centences,
the first ending after "stupid" and
MRAB,
> You don't "del" an instance, you "del" a reference, which might be in the
> form of a name in a namespace.
Remember me, the newbie to the language ?
Did you understand what I tried to to say ? Good. Thats al that matters.
> When the instance is collected, whenever that happens to be
Paul,
> You do understand that the reference counting garbage collector is an
> implementation detail of the CPython implementation *only*, don't you?
No, I don't. But do tell how that matters to me.
> there can be an indefinite delay between the last reference to
> a value being lost and the
MRAB,
> From the help:
...
> Do not depend on immediate finalization of objects when they become
> unreachable (so you should always close files explicitly).
Do you notice there is not a single word about (the delayed action of) the
__del__ method in there ? Why than do you think its talking a
Dennis,
This is the first time I've seen you post FUD. :-((
> It is called when the language IMPLEMENTATION decides to call it.
> That time is not specified in the language description/reference manual.
I'm rather sure it neither specifies that for any of the other commands.
Does that mean that
Roel,
> Rudy, unless/until you know the language inside out, you'd better listen
> to Chris and other people here who spend a lot of time and effort in
> helping people like you.
I tried. But what he said made no sense to me, and no matter how hard I
tried I could not get Chris (or others fo
Chris,
> Once again, you make positive assertions about things you
> don't understand.
And you have refused to bring any kind of help (explanation!) forward that
could have shown me the erring of my ways, as well as refusing to adress my
(attempting to explain) examples.
You might know a thing o
Dennis,
> In common Python, small integers are cached internally for reuse
That is what I imagined could possibly be happening, reading the specific
"the integer 5" formulation in the question ("reading between the lines" and
all that).
And thanks for that explanation, underbuild an all. :-)
Rhodri,
> the object that is the integer 5 *isn't* deleted
That was not the question. And you're now referring to the object as well
as the integer, which makes it confusing. You also have not explained what
happens instead. In short, your above statement has ZERO value to me.
> On the cont
MRAB,
> You merely disabled the mark-and-sweep collector.
Nope. Go check the docs on "gc"
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
Michael,
>> So, only the reference count gets lowered. Yep, thats daft.
>
> Why? Consider:
You missed the point.
It was-and-is not about decrementing a reference but still having it above
zero, but what happens when the reference becomes zero: is the __del__
method called directly (as I find
Antoon,
> Well yes that is why it is stupid to rely on the garbage collector to do
> those things for you. That is why Greg Ewing already stated:
>
>> If your object has a method for explicitly making it release its
>> resources, it would be better to use that rather than rely on
>> the garbage co
Chris,
> Okay. What should happen when you do this?
>
> x = 5
> del x
>
> Should the integer 5 be deleted?
Yep.
What do you think happens instead ? I've not seen you explain or support
anything in that regard, not even now.
There is a bit of a problem with the above though: It has got zero t
Python,
> which contradicts your previous statement.
I don't think so.
> "with" is "more stuff" it is the right way to deal with disposable
> ressource in the first place.
Than you have missed the point altogether. It isn't about what you think is
the perfect way to deal with something, but
Chris,
> Well, that's exactly what happens.
So, only the reference count gets lowered. Yep, thats daft.
... unless you explain why it can only be done that way.
> Also, when you scorn something without knowing your facts,
> you tend to make yourself look like a fool :)
I tend to go with logic
Greg,
> In that case, it was only working by accident.
I don't think so.
Or you must be thinking that the __del__ method of an instance is only
called by the garbage collector - which would be rather daft (just think of
a file thats created when initialising an instance, but not closes until t
DL,
> I went through this cycle of thinking, first using if __name__... to
> 'hide' testing, then adding test functions within the module, and now keep
> test code quite separate from 'the real thing'.
:-) The normal newbie progression, off of which I'm in phase #1. Having a
working program
Dennis,
> "del instance" only deletes the NAME.
[snip]
Yep, I already assumed that that would happen. Just wanted to keep it
simple.
> "instance" xyz does not shadow "class" xyz... instead, the name "xyz"
> only exists in the binding to the instance.
That is what I tried to say: the name-bind
Greg,
> There's nothing stopping you from subsequently rebinding that name to some
> other object, or deleting it altogether.
Which is something I did not expect. But running into is what makes doing
something new interesting. :-)
And I just realized something else: I just assumed that the "d
Python,
> Child *depends* on Parent.
I'm sorry, but without any kind of underbuilding statements like that are of
no value to me I'm afraid.
Also: if I can just copy-and-paste the class into the file which origionally
included it and have the whole program run without a problem than that
depe
Greg,
>>> Are you sure there's a difference between classes and functions here?
>>
>> Yes, quite sure.
>
> And we're even more sure that there isn't. :-)
As it turned out "we're" are right, and I was thrown off by the error
message. :-p
The problem is that I had no idea why I got that (rather e
DL,
> Some of this you will know. (Hopefully) some will be 'new':
Some of it is known to me, and indeed I do hope that there will be new stuff
in there too. Its why I took up Python. :-)
Thanks for the explanation (including the aliassing I wasn't aware of) and
the links.
Regards,
Rudy Wiese
Terry,
> Not really. The resulting global objects do not normally take enough
> space to worry about on normal modern desktops.
For some reason I still aim to keep my (running) programs as small as
possible - even though the ammount of memory has grown more than a
thousandfold since I started
Dennis,
> Common practice is that the class is capitalized. Instances
>are lowercase.
Thanks.
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
Peter,
>> "from file import function" works, but fails when I try to do the same
>> with a class.
>
> Are you sure? It should behave the same for any name in the module.
I am.
At least, that is what the error said: "cannot import 'classname' from
'filename' "
But as it turns out the problem is
Python,
> from the_file import ClassName
>
> should work. I guess that your class name is not "class" right?
You guessed that right. :-) Not a good idea to pick confusing names like
that, especially when you do something the first time.
> Note that in all cases when you import a module (either
Chris,
> Are you sure there's a difference between classes and functions here?
Yes, quite sure.
If not my attempt to load a class he same way as a function would have
worked. Which it doesn't.
> Try "from file import function" and see if it runs commands at
> the root of the file.
What funct
Hello all,
Using Python3 I would like to import a specific class from another file (in
the same folder), and have trouble doing so.
"from file import function" works, but fails when I try to do the same with
a class.
"import file
x = file.class"
works, but also executes commands that are in t
Terry,
> I have been using tk/tkinter based IDLE for over a decade on Windows with
> very few issues. I think they are similarly stable on linux, etc.
[Snip]
Thanks for that explanation.
And I see that, in my question, I should have asked for the involved OS too.
Regards,
Rudy Wieser
--
ht
Terry,
> R.W., are you reading via c.l.p, or the python google group?
The first, using nntp.aioe.org
> Don't hold your breath. A similar poster I challenged on StackOverflow
> was honest enough to admit that he had not touched IDLE for a decade.
Its just that I've just began to touch tkinter,
Moi,
> tkinter/IDLE in py380 : completely buggy.
Example code please ? (plus a description of what should happen and what
happens instead if you have it)
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
Dennis,
> So... extract the original args, then build a new args object with your
> added argument, then call your new function with that...
I wanted to respond that prepending a string to an existing argument sounds
quite a bit easier than what you are describing, but than I realized that I
ju
Michael,
> If you mentioned RPi.GPIO before, I apologize for my mistake.
No I didn't, there is nothing to apologize for.
> That's very helpful to know.
I have no clue to why it would be, as my question has got *zero* to do with
it - its valid for /any/ extension using the CPython C API.Jus
Luciano,
> Now that's a novel approach to asking for free help: pretending
> to be smarter than the people who are trying to help you.
What makes you think I'm /pretending/ ?*Ofcourse* I'm smarter than
anyone on this earth, didn't you know ? :-D
But I'll let you in on a secret: I'm rather a
Michael,
> Sure but the Python methods* themselves are exposed and accessible
> and according to your previous posts, all you want to do is add an
> argument to a call to the existing method. If that's true, then you
> should be able to do that part from pure Python.
>* class methods defined by
MRAB,
> It could be something like this:
[snip example code]
Thank you very much. Your "Call the other method" line shows me that I've
been overthinking things. :-(
After that I decided to see if I could give the "py_proc1" function two
arguments, which worked. That means that the prepending
Michael
> Does this have to be done in the C API?
As far as I can tell, yes. What I need to do is not exposed by the
extension itself, meaning that a wrapper class can't get access to it
either.
And its just a syntax problem. I currently simply have not enough knowledge
about the CPython AP
Peter,
First things first: For some reason I see your message coming in empty, but
with two attachments. An "att*.txt" one with the actual message contents,
and a "signature.asc". Makes it kind of hard to read ...
> No. There are many reasons why sleep() might return after t
Not /that/ many
MRAB,
> One possibility is to refactor the code so that py_proc1 and py_proc2
> themselves just handle their arguments and then call the function that
> does the actual work.
The thing is that the arguments of py_proc1 and py_proc2 are the same, but
for a single argument. Which means that le
Hello all,
I'm trying to edit a binary extension to Python, and have a situation where
I would like to create method which adds a single argument, and than jumps
to / calls another method. Like this:
static PyObject *py_proc1(PyObject *self, PyObject *args)
{
Py_RETURN_NONE
}
static Py
Dietmar,
> I would assume that this is not an application that needs to output a 100%
> correct pulse train every time.
Correct. Thats in the design of the pulses themselves (25% duticycle for
one state, 75% for the other. Lots of leeway, and self synchronising)
> You may just repeat the pa
Pieter,
> Do you mean, if Proc1() is called from Func1, it uses MyVar defined
>in Func1, and if it is called from Func2, it uses MyVar from Func2?
Yep.
> If that is what you mean, that would be dynamic scope.
Thanks for pointing that out (I've learned a new definition today! :-) ).
Regards,
Ru
Dennis,
> The first thing one needs to learn is that Python does NOT follow the
> common post-office mailbox concept where
>
> x = y
>
> means the /value/ stored at location identified by "y" is /copied/ to the
> location identified by "x".
:-) Although that is how we humans remember the effect
Michael,
> Well I've only seen this done in languages where other mechanisms
>for returning complex types are not present.
:-) Than you have not seen to many languages I'm afraid.
There are quite a number of languages where /every/ type of argument
(including values) can be transfered "by refer
Dennis,
> No, that addition is a fixed increment on the initial starting
> time, and is NOT relative to the ending of a sleep.
> No, that addition is a fixed increment
Yep.
> on the initial starting time
Nope.
If pythons sleep is worth its salt it ends exactly on the time provided in
"t".
Terry,
> This is discouraged for anything very complex.
Complex things do not exist. If you think you have something like it you've
just not yet broken it down in its components yet. :-)
> This is the standard way in Python and other OO languages. By 'excluded',
> do you mean 'rejected', or
Chris,
> That doesn't really answer the question.
The problem is that you want to solve /this/ problem, while I'm looking for
replies that are applicable to similar ones too.
To be blunt about it: I consider solutions that only solve a single problem
most always as a waste of my time (exceptio
Rob,
> On an actually practical note; ever since they started baking the
> quasi-realtime stuff into the Linux kernel, you've been able to use the
> whole sched_setscheduler(2) family of calls (from C) to set a process's
> real-time priority.
Its something worth to look into. Thanks.
Regards
Dave,
> OK I'm old enough cancer to know what X10 is. :-)
Ah, so that is the name I forgot. :-)
> I wouldn't think this is too difficult to do as you're only sending.
You're right, codewise it isn't.
> For this application IMO there is too much going on inside python that can
> interrupt the
Michael,
> I note that you didn't answer the question, what are you trying
> to accomplish?
I think I did - though implicitily. What do normal people use "by
reference" arguments for ? Yep, that is what I wanted too.
> It looks to me like you're trying to write a program in a different
> la
Dennis,
> The R-Pi has never, to my knowledge, been billed as suitable
> for industrial/real-time/process-control...
I have not read those specs to be honest. But for some reason I assumed
that a 1.4 GHz machine should easily be able to generate a 1.6 KHz signal,
even using Python. I was wr
Dennis,
> Ugh -- let's try Google Drive...
I was able to download them, thanks.All but the 100uSec one seemed to be
rather stable.
> That is what I'd thought, but if you've looked at that simple program I
> used, apparently the "run longer" was taking place between the
>
> t +=
>
> and the
Dave,
> Can you expand on what you are trying to accomplish with this?
There is a small 433 MHz rf transmitter connected to the pin, and when I
send the right pattern a wireless wall-wart will respond and switch a lamp
on or off. Its just ment as an example of a real-world application of
P
Richard,
> Assuming that one language works like another is a danger
Abitrarily redefining words and using misnomers is another ... ("global"
and "nonlocal" respecivily if you wonder)
> First, Python doesn't really have 'Variables' like a lot of other
> languages
> (they don't hold a bag of b
Michael,
> nonlocal does not share or use its *caller's* variables. Rather it
> reaches into the scope of the outer function where it was defined.
> That's a very different concept than what you're proposing.
Oh blimy! You're right.Its an at compile-time thing, not a runtime
one.
Thanks
Jan,
> So what you want to do is dynamic scope?
No, not really.I was looking for method to let one procedure share a
variable with its caller - or callers, selectable by me. And as a "by
reference" argument does not seem to exist in Python ...
And yes, I am a ware that procedures can ret
MRAB,
> 'nonlocal' is used where the function is nested in another function
The problem is that that was not clear to me from the description - nor is
it logical to me why it exludes the main context from its use.
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
Rhodri,
> MyVar is a global here, so nonlocal explicitly doesn't pick it up.
I do not agree with you there (the variable being global). If it where than
I would have been able to alter the variable inside the procedure without
having to resort to a "global" override (an override which is only
Jan,
> The nonlocal statement causes the listed identifiers to refer to
> previously bound variables in the nearest **enclosing scope excluding
> globals**.
I read that too, but didn't get from it that the main scope is excluded (I
assumed the"excluding globals" was ment at as such dec
Hello all,
I've just tried to use a "nonlocal MyVar" statement in a procedure
defenition, but it throws an error saying "Syntax error: no binding for
nonlocal 'MyVar' found.
According to platform.python_version() I'm running version 3.8.3
Why am I getting that error ? (already googeled ofcours
Dennis,
> You know... I never finished my thought there...
:-) I already got the feeling I missed something there.
> ... 1.6kHz appears to just be viable (there may still be a context
> switch but it wasn't visible on my o'scope)
Thats ... slow.And a limitation I definitily have to remember
Dennis,
> Let's see if I can remember how to use my BK Precision
> 2542 scope...
:-) You didn't have to do that. I was already planning to put my TDS 210
(tektronics) scope to work today, if only to see what the effect of
drift-compensated sleeps would be (inserting some print commands here a
Dennis,
> Avoiding drift still comes down to computing the time (in some unit)
> at which the interval is to expire, and then delaying for the difference
> between that time and current time.
Yep. And although that can be done with Python, I had hoped to be able to
shift all that to lower-leve
Dietmar,
> It *is* real-time...
> Real-time is not about speed, but about guaranteed timing.
What I tried to indicate is that the Pi has 500,000 cycles to work with
between two of those time events. I consider that to be quite a few.
> at least not on a multitasking non-realtime system.
Yep
Luciano,
> Mr. Wieser, I haven't seen you mention which library you're using
> to write to GPIO with Python.
To be honest, I took a "blink.py" example as a base, and just went with it.
So, I had to look it up. Its the first one you mentioned, RPi.GPIO.
Thanks for telling me about WiringPi's be
Dietmar,
> Actually, with such requirements you're usually better off with a
> microcontroller.
Probably, yes. /Anything/ is better than a multi process mini 'puter for
tasks like these. Doesn't mean I'm not going to try though.
But honestly, generating a "modulated" 1.6 KHz square-wave sign
David,
> The general simplified idea was run it whenever the time is 0 modulo
> your interval. So you ask how long until that next time.
Ah, using the perf_counter() as its own reference (no "last time fired"
storage needed).
Thanks for the explanation.
Regards,
Rudy Wieser
--
https://mail.
Rob,
> 300us is getting on towards realtime.
Not really. Translated to a frequency (toggeling the pin) it would be just
1.6 KHz. Thats rather slow for an ARM machine running on 1.4 Ghz (about a
million times as fast).
> I've never tried it that fast.
I've already got it running it using th
Dennis,
> So... you need to adjust for the time spent in processing between
> calls to sleep().
That was my first thought too, but any code calculating that adjustment
before ultimatily calling sleep itself can also be interrupted.With that
in mind I was aiming/hoping for something with a /
David,
> timeInterval = 0.0003
> time.sleep(timeInterval - (time.perf_counter() % timeInterval))
Possibly: any reason for the performance counter modulo the interval ?
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
Skip,
> Take a look at threading.Timer.
Thanks. It seems to solve the problem by calling it at the start of the
executed code (instead of the end), but costs thread usage ...
Regards,
Rudy Wieser
--
https://mail.python.org/mailman/listinfo/python-list
Hello all,
I'm writing some code to toggle a pin on a Raspberry Pi, and would like to
have that happen at (multiples of) 300 uSec increments.
I tried time.sleep(), but that one disregards the time after the last one
ends and the new one is started. In other words, all the time spend in code
(
Dennis,
> However -- manually changing date/time is not going to illustrate this.
> ANY change made to date/time will reflect a change in UTC time.
It turns out that the get_uptime() does /not/ calculate the boottime from
the current clock minus the uptime. Its a seconds-since-epoch (absolute!)
Dennis,
> Well... If it is the last file written during shutdown, it would be
> the "last file system modification time"
Yep ... up until the next hours cronjob overwriting it ...
Currently I've got a (very) small init.d shellscript which copies the
contents of that file into another one - whi
Chris,
> Yes, but even if it's not recorded as a timestamp but as an
> uptime counter, that counter can be referenced against the
> current time in UTC.
Absolutily. Though the keyword here is "can". My "could easily imagine"
considers the other possibility.
I guess I should sit down sometime
1 - 100 of 117 matches
Mail list logo