« first day (3248 days earlier)      last day (1925 days later) » 

01:27
cabbage
 
1 hour later…
03:20
If I have multiple .py files in Visual Studio 2019, how can I choose which one is executed, since Python doesn't use main() as a starting point?
 
3 hours later…
06:33
@WayneWerner amazing
user10984358
07:00
Kinda reminds me of matrix for some reasons. Would be glad if YouTube recommended videos of such categories to me.
07:26
cabbage
tkinter canvas dump to postscript does not render unicode after ps -> pdf (that shows on canvas). Is there a way to fix this?
PostScript Conversion Warning
Converting the PostScript file “my_drawing.ps” produced the following warnings:
· .sfNsText not found, using Courier.
using osx preview
user11419266
07:44
```class tkinter:
    def __init__(self,root):
        self.root = root
    def run(self):
        name = self.root
        length = 33
        size = '142cm'

class Un_splash:
    def __init__(self, name,length,size):
        self.name = name
        self.length = length
        self.size = size
    def show_tkinter(self):
        print(self.name, self.length, self.size)````                                                                           how to get value from diffrent and print in another class
user11419266
how can I get value from first class and print in second class
user11419266
Is anybody can help me?
Please post an mvce @rohit
and look here too: sopython.com/wiki/…
how to format your code in chat
Nice video @WayneWerner
 
1 hour later…
09:03
@payne please don't ask for help with fresh questions here as per our rules. Since it's weekend with low traffic try again on Monday.
09:18
Well, I'm utterly confused about SSL. Trying to connect to my site via its IP address is insecure, but using the domain name is secure?
I always thought the interwebs just translated all the domain names to IP addresses in the DNS and that was that. I didn't realise that the fact that you actually used the domain name in the first place carried any weight
09:43
You were already directed to a resource on how to format code in chat :/
I don't get the point of the tkinter class, and even more so the run method. They look completely pointless
2 hours ago, by Reblochon Masque
and look here too: https://sopython.com/wiki/An_Illustrated_Guide_To_Formatting_Code_In_Chat
run defines some local variables and nothing else?! that's like a 3-line pass
user11419266
yes
Ok. You can't extract name, length and size from tkinter because those things only exist in the run method.
user11419266
09:50
Is there any way to extract those value in second class.
user11419266
Any another way I can do this.
Twice now you've been linked to something that tells you how to format code in chat. You're just going in circles and the statement earlier by Aran-Fey did not get addressed by "yes".
10:25
@ReblochonMasque vague guess but that might be a font issue. Have you tried setting a different one? stackoverflow.com/questions/31918073/…
Woohoo, finally solved all the issues with V1 of my site and can finally link it on my profile. What a mare to get it working properly!
let me guess...night?
Yeah, maybe I should have used 'mare. It's an expression that invokes a bit of silliness in the UK instead of "nightmare"
I figured :P
Still, one hell of a slog on the last parts. Totally different to running apps on an intranet
10:55
Yes, maybe @AndrasDeak - I changed fonts and got the same, then I saw that there are font collections on osx; some are labeled pdf fonts, so I tried that, but not luck.
Looks like our friend Rohit decided to post his unclear question on SO main... with an alt account
Whoa, the mods work fast today
11:25
Neat
12:09
I've got a math-y question. In a game I play, enemies have an armor stat that reduces incoming damage by the following formula: dmg_multiplier = 1 - (armor / (armor + 300)). There's a mechanic that lets me reduce the enemy's armor by 25%. I can calculate how much that'll boost my damage with the formula dmg_boost = (dmg_multiplier(armor*0.75) - dmg_multiplier(armor)) / dmg_multiplier(armor). Apparently the maximum dmg boost I can expect is 33%, and I can't figure out why.
Intuitively, I'd have expected the limit to be 25%. Why is it 33%? I can't wrap my head around it
(In math language: Why is the limit of i in the formula i = ((1 - (0.75a/(0.75a+300))) - (1 - (a/(a+300)))) / (1 - (a/(a+300))) exactly 1/3?)
I can take a look later
thanks
Limit in what sense?
No matter how large you make a, i won't exceed 1/3
OK, thanks
12:16
how do you kill a subprocess like "control.exe mouse"? When I try to use pid, it kills "control.exe" but the mouse properties window stays open.
p = subprocess.Popen(['control.exe', 'mouse'], stdin=subprocess.PIPE)
p.kill()
I am using this on Windows.
@Aran-Fey if you rearrange that you get (a + 300)/(3a/4 + 300) - 1,and the a->∞ limit of the first term (a»300) is a/(3a/4)=4/3. Subtract the 1 and you get 1/3.
It might have to do with the fact that 25% of the full is 1/3 of what remains
Oh, it makes sense if you put it that way
That's a concise and precise way to say it @AndrasDeak - I was writing a long paragraph...
@amrtw09 Good question. I suspect the process you need to kill is actually explorer.exe - but that's probably not a good idea...
@Aran-Fey Yep. That's where I am stuck at.
12:28
I know for sure that the control panel is actually the Windows explorer, but I'm not sure if the mouse settings dialog is, as well
I wonder if there is a way to get the pid of mouse properties
when I use p.pid it gives me control.exe's pid.
13:28
is there a way to have Sphinx treat a (singleton) instance as the index target of a class? I have an .. autodata:: my_module.thing which is supposed to be used as the sole instance of my_module._dragons.Thing - so I would like references such as :py:class:\`~my_module._dragons.Thing\``` to link to :py:data:my_module.thing instead.
the sphinx docs were... not enlightening
What generates those references? (I'm assuming they're generated by something, because if they were written by hand you could just reference the module.thing instead... right?)
13:41
it seems that directives such as .. py:class:: create the index target automatically
I am not using those for content of modules where dragons lurk, though
sorry, I misunderstood the question. the references are written by hand, but it is somewhat inconvenient to have to think closely about the green pastures of the user-facing API while treading carefully through the dark dungeons of the meta-dragon API.
there are some occasional auto-generated references to base classes, which are similarly awkward
Knowing Sphinx (kind of), I strongly suspect that the easiest solution would be to Ctrl+H replace all those incorrect references
 
2 hours later…
user10984358
15:58
heya, what should I be looking at if I want a program to do the same operation at say 9 am everyday? I dont want to put it in a while and use datetime
@TheNamesAlc Look at making it a cronjob
crontab
user10984358
crontab? or cronjob?
trivial in linux. If you are doing it in windows, you need to look at making use of scheduled tasks.
user10984358
Mac :/
16:01
@TheNamesAlc That's still *nix-like. So cronjob is your solution
look up how to set up cronjobs on your mac. You should be good. Tons of info
user10984358
this is a but more, but will it keep running after I executed it only once?
user10984358
even if I turn my Mac off?
cron will only work if your PC is turned on at 9am though. If you turn it on at 9:01, cron will do nothing
Yes. I was just typing out something similar. You have to be careful about that.
user10984358
so my requirement is I need that to tell the price of a product from amazon every 9 am, and it should be executed only once
16:03
Don't know what your set up is like, or how many computers you have at your disposal. But you want to set this up on the thing that is always on
user10984358
but run till I close it manually
user10984358
so I need something like a server then
I didn't read this in full detail, but you might be able to hack around something with something here -> superuser.com/questions/14836/crontab-to-wake-osx-from-sleep
So, seems like you can set up some kind of scheduled wakeup a little before, and then have it run.
user10984358
will this be of some start point stackoverflow.com/a/15090893 ?
user10984358
so I should be using thread concepts or cronjob is totally different ?
16:13
@TheNamesAlc why not use a while and datetime?
threads and cron are completely unrelated. cron simply launches your program at the specified time
user10984358
@MisterMiyagi is that good? I feel like something must be there for a scenario like so
user10984358
if I am using threads or something hopefully take the load of as opposed to an infinite while ?
You're overcomplicating things and threads really aren't a part of this. Your process is going to be the script you are running. That script doesn't need to worry about threads. It has a single job. To do some kind of call that checks a thing. But it has to do it "indefinitely" until manually stopped. There are two areas of responsibility here. There is the functionality of the script, and the how the script will run.

- The script itself can run in some loop until manually killed. However, keep in mind that when you set it to run through cron, you will be running it most likely as a backgr
you have to sleep either way. it doesn't really matter what sleeps
16:25
there's also anacron
so efficiency shouldn't be your concern, especially if you do not know the different approaches anyway
there is launchd, and there is...
You said your script should do something once, but you close it manually. that seems odd. I suspect, and maybe I'm wrong with my assumption, but I feel like your requirement to want to manually kill it might be misguided.
Since you want the code to run once and only once to get that result you require, why do you want to kill the process yourself?
welp
are we really surprised though? lol. Apple loves doing stuff like this.
hehe
I'm sure you can get iCron for a measly $999
16:35
or just get a server for $2/mth and let it do it? :p
although... probably could get it free from Amazon Lightsail/Beanstalk/whatever since you're not going to want computational resources/even much bandwith anyway
I was thinking something similar but figured putting a cost on this would probably not be desired.
I used to do this stuff when I had tons of credit on digitalocean
no more though 😃
@AndrasDeak missing features are the new dongles
Don't know about iCron, but you could get an Apple monitor stand for that price..
HEY! I'll have you know that stand swivels like no other.
1000$ swivel device? SIGN ME UP
17:16
Hi, @idjaw. You might like the Mona Lisa Twins. Originally from Austria, now living in Liverpool, England. They do great Beatles covers, and other stuff from the 60s, plus they write new 60s-style songs. Here's their version of Day Tripper. Yes, they are actual twins, although not identical, and their names are really Mona & Lisa.
Yay! I got another Astronomy answer on the HNQ. :) It's a small site, and even the HNQs don't usually get a lot of action. But hey, it's better than nothing. :) astronomy.stackexchange.com/questions/33276/…
user10984358
17:56
well by manually kill it I mean at some point I just dont want the script to run, like say it has been running for 15 days straight and I decide to stop it, I must have rephrased that better earlier
user10984358
it checks for the price every 9 am and if its less than the usual set price (hardcoded) then it will send me an email, thats essentially it, so after the product goes on a sale I dont need the script running anymore
:472439 Then there is absolutely no need to put it in a loop at all. You just want to call the script once, and that's it. It will end on its own. Just don't put any kind of while True or any other statement that has it just stay alive indefinitely. You want it to run once at 9 am, then your command in your cronjob configuration would be something along the lines of like: python my_code_thing.py
and that's it
@PM2Ring awesome. Queuing it up for my drive. Thanks.
user10984358
alrighty got it thanks everyone
np
user10984358
when pastebin says unique visits is it actually IP based?
user10984358
18:03
I sent a pastebin link to someone and they haven't yet acknowledged my message but the count shows up as 4. I had it set to unlist before giving the link
user10984358
now its 5, do my refreshes increment that? I have been on the same wifi network, maybe the router restarted ?
user10984358
0
Q: Run python program in background

SeanCedricI have written a Python program that checks product prices and sends me an email whenever the price drops. It checks for the price once a day and I would like to make this program run in the background. What is the best way to do this? I have seen a lot about just putting an & behind the command...

user10984358
what are the odds
user10984358
just letting everyone know that is not my alt or anything, dude legit has the same thing I am asking for
18:21
would it be possible to implement python's threading modules as standard C python modules?
18:33
I'm not sure what exactly a "standard C python module" is, but I don't think you can avoid using C to implement threading
(well, maybe you can, but you probably shouldn't)
well I'm not sure either
because I'm not sure where the line is between "python module written in C" and "extension to the python interpreter"
or even if there is such a line
I guess that's part of the question
AFAIK C modules only work with CPython
I guess I'm not very familiar with python interpreters
so if try to import stuff, in the presence of a stuff.so file, that'll raise an ImportError if I'm not using a CPython intepreter?
@JonClements Where are these $2/month servers? :P
@JackM don't know, sorry
19:00
The threading module is written in Python. github.com/python/cpython/tree/3.7/Lib/threading.py But it "constructs higher-level threading interfaces on top of the lower level _thread module".
19:13
this Near-duplicate of Most Pythonic way to print a newline. For the love of God, one user is even saying "You need byte strings..." Give me strength.
@JackM threads are provided by the OS, and OS APIs are written in C
but in principle anything that can speak the proper ABI is fine
both CPython and PyPy use C bindings to the OS, though
19:29
but where is the line between "a python module written in C" and "a plugin that modifies the interpreter"
and on what side of that line does _thread fall
basically, is _thread a sort of language intrinsic, or could it be constructed from lower level language features?
okay, this is a rather complex topic - try not to fall too much into assuming categories
so, in principle you could write a pure-python module that just assembles some bytes and puts them in the correct location
and by that measure speak the ABI of something initially written in C
which, in principle, allows to write _thread in Python
which, in practice, no one is going to do (hopefully)
but to implement _thread, you have to be able to set the python interpreter Instruction Pointer, right?
can you really do that in pure python?
and now we are at the category level of "pure python" ;)
what do you consider "pure python"?
well, a .py with only python in it
no?
just syntax like if, for and def? or also object, property, bytes and the like?
19:35
I don't have a problem with bytes
alright, because they are implemented in C
well, so is if in some sense, no?
well okay, I suppose if isn't an identifier
it's not a function/class/callable etc
I see what you mean
but let's say we allow bytes and anything else that can be used without an import statement
that still gives us __import__, actually
well, supposing a reasonable interpretation of "python only", how would you manipulate the instruction pointer to implement threading?
I think you guys are just splitting hairs at this point
19:42
true, that wasn't my intention
apologies
no need to apologize, I just didn't think you were going to make any progress that way
...Just another day in 🐚♜ ρα𝔯ⓐ∂Ꭵˢ𝒆 🐤👻User wrongly insists they need to store an explicit newline character inside a multiline string. Then substantively edits their question a further six times in 15 min. Anyway it was a duplicate of Most Pythonic way to print a newline
I don't think it's a dupe of that - as I see it, the problem is that the OP is looking at their output in a REPL rather than printing it
@smci I don't see in any way how "I don't know how to print things, help" is a dupe of "what is the idiomatic way to use print to output a newline"
It's a mess that's not worth polishing IMO, so I've cast a delvote
19:46
@MisterMiyagi I just spent 15 minutes and posted an answer explaining to the OP exactly why. Go read it please.
@smci your very first sentence is factually wrong already. I have little desire bickering with you again.
@MisterMiyagi hmm, are you sure that applies to stdout? I'm not convinced sys.stdout is a file object in the sense of that PEP
either way, about the threading @JackM, I recommend you try not to get hung up on the "Python versus C" front too much. remember that PyPy is pure python in pure python (compiled to C).
@Aran-Fey unless you write to its bytes buffer, yes.
it's not so much the python/C distinction that interests me, more module/interpreter
CPython doesn't really have "plugins" per se. just shared libraries that may or may not call its "add a module like this and that" API.
19:59
@MisterMiyagi note that such remarks will invariably incite or prolong bickering. You don't have to have the last word. Just don't argue.
20:21
close votes are back to 5 :(
yup :(
Shog will report next week
I wasn't on SO much, but it looked like a major improvement to me
it was, and the CVQ diminished quite a bit
the real question is probably how often close/reopen wars appeared
easy solution: closing requires 3, but reopening requires 5 ;D
right :P

« first day (3248 days earlier)      last day (1925 days later) »