« first day (3651 days earlier)      last day (1522 days later) » 

user14264035
00:40
Nvm got it
05:49
Hi guys, how to use specific version of python on the command line? like python 3.7 or 3.8 or something?
Ive been googling, but seems like my search terms arent giving me any related answer
06:23
python3.7?
you can just type that, or you can always use the absolute path
type that? like python3.7?
'python3.7' is not recognized as an internal or external command,
operable program or batch file.
Raj
Raj
do you have both versions installed?
@Raj Yep, python 3.7.4 and 3.8.5 and now 3.8.5 is the one recognized by cmd
Raj
Raj
ok. On which OS are you on?
Windows 10
Raj
Raj
06:32
do you have both the python versions executables mentioned in environment variables of the windows?
probably, the best way would be to access the required python interpreter by searching in the start menu
174
Q: How to run multiple Python versions on Windows

Bilal BasharatI had two versions of Python installed on my machine (versions 2.6 and 2.5). I want to run 2.6 for one project and 2.5 for another. How can I specify which I want to use? I am working on Windows XP SP2.

checkout the answers here, it might be helpful in your case
Hmmm im wondering for pip, pip always uses the 3.8 version, how to change that ?
@Raj Okays thanks, got some idea!
06:47
Always prefer python -m pip to pip - that way, if you know which python you are running you always know which pip too!
6
@holdenweb oh whats the -m ?
Specifies a package to run as a command. The package's __main__.py will be run, I believe.
Note that from pip import __main__ works, demonstrating pip is suitable to be run with -m.
@holdenweb Kay, Thanks mate, will use it :D
 
1 hour later…
08:03
@holdenweb This is a message worth repeating again and again! A little effort that safes a lot of trouble.
I've pinned it to my profile so we'll see if that makes a difference.
I somehow doubt it!
08:37
Could I ask advice about the method I am looking at relating certain tables in the models from anybody just to make sure my thought process is logical annd not overthought
 
1 hour later…
10:13
Tomorrow seems to be 10th year since first message was posted in this room. Happy Room-6-versary!
World might still end by tomorrow
That's why I'm calling it out before tomorrow. :D
@AndrasDeak plants tree
10:37
too pessimistic. oops.
11:09
Updating my database to Heroku has giving me another new challenge. I keep getting the error sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateTable) relation "user" already exists every time I try to update my heroku postgre database by running heroku run flask db migrate.
This should be able to solve that, but it does not. When I check the status of my database using the command heroku pg:info DATABASE, I see that no tables are present. Logs show that any attempt to sign in or sign up (any access to the database) shows that the 'user' does not exists. What could I be missing out on? Please find the full context of my problem [here ](stackoverflow.com/questions/64345077/…)
11:30
flask db migrate does not create any tables
Oh, please note our room rules. You should wait at least 48 hours before linking to a question you have on the main site if you haven't already got an answer
11:43
Has Google.com seemed flaky lately, or is it just me?
Interesting: SO is unavailable here due to a routing loop!
traceroute stackoverflow.com
traceroute: Warning: stackoverflow.com has multiple addresses; using 151.101.129.69
traceroute to stackoverflow.com (151.101.129.69), 64 hops max, 52 byte packets
 1  gw-mesh (192.168.5.1)  3.978 ms  2.559 ms  2.447 ms
 2  192.168.1.1 (192.168.1.1)  2.363 ms  3.064 ms  2.414 ms
 3  host-212-158-250-36.dslgb.com (212.158.250.36)  10.677 ms  10.360 ms  10.645 ms
 4  63.130.104.194 (63.130.104.194)  13.285 ms  11.872 ms  12.681 ms
 5  10.200.18.37 (10.200.18.37)  12.275 ms  12.893 ms  13.210 ms
I was alerted to this when my browser just sat there spinning, and pinging it gave TTL Expired ICMP messages.
The browser, blithely unaware of this network-layer failure, happily spins until it times out. Hrrmph.
Time to switch to the backup fibre and see if that sees the same problem.
12:03
hop 5 routed to a 10.0.0.0/8 after going public obviously shouldn't happen
12:21
You sometimes see that if a network isn't careful about not letting internal nodes report structural data. They shouldn't be answering random UDP packets ... or something should be egress filtering or otherwise handling them. Networking nowadays is far more complicated than it used to be ...
true, but that also is an indication that something really went wrong with routing
The other fibre doesn't see the same loop, so this is likely a Vodafone problem. I'd call their network support and report it, except a) nobody in support would know how to reach network operations, and b) by now loud alarm bells should be clanging anyway.
Cool - the fibre switch took fifteen seconds plus about a minute to reboot the master mesh node, and I'm seeing SO again. The investment paid off.
12:46
@roganjosh Sorry about that. I have read the room rules
@roganjosh How about heroku run flask db upgrade? This was the command I ran, not heroku run flask db migrate
morning cabbages, folks!
I have a flask app which does some calculation / users upload file ---> do calculations, are there some major price differences using heroku or aws ?
13:06
Here's a (comprehensive, though not very critically thorough) comparison between Heroku pricing and AWS pricing
anyone have any thoughts on PEP 638: Syntactic Macros?
13:40
@inspectorG4dget The basic ideas seem sound, but I don't believe the PEP fully explains the workings of the three different types. Maybe I've just not read it carefully enough. Skippy Hammond is sound, though (he wrote PyWin32).
What do you make of it?
But you linked the PEP to an Amazon pricing page ...
I'm pretty excited to see what I can do with it to tersify my code even more. That being said, I don't know if there's more opportunity to build a bigger cannon to just shoot myself in the foot
Re-reading it, I now git the difference between the sibling and the statement macros. It took me a while to suss that "additional names" in the latter were bound to the AST subtrees of the indented suites.
It's an elegant mechanism.
How easy will it be to abuse it to write unreadable code? That is my primary qualm with asspressions, but in this case I can't judge.
Is a whitespace (for example: new car - the whitespace between new and car)in google search equivalent to an OR operator?
asspressions? I'm afraid I am unfamiliar with that terminology
13:56
@inspectorG4dget assignment expressions python.org/dev/peps/pep-0572
@SpedoDeLaRossa no
@SpedoDeLaRossa but you don't seem to be a python user and this doesn't seem to be a python question
@SpedoDeLaRossa you could probably spend weeks months researching that and write several blog posts about how search works. Start with understanding PageRank, and move on to about a decade's worth of Google's research. Then try to figure out everything that's opaque (that they haven't published)
@AndrasDeak ahh! the good ol' walrus
14:19
@inspectorG4dget Not a fan of macros. Both source code and parse-time are a leaky scope with lots of unnecessary restrictions – things being first class at runtime is a powerful concept, both for features and predictability. Plus, I really, really, really prefer to have meta-programming hidden away behind abstractions.
14:34
obligatory mention: there already is macropy for those that actually need macros.
Hey guys I have recieved the link for free T shirt from hacktoberfest .My question is that can I get multiple T Shirts or only one?
@MisterMiyagi oooh! that's a very good point. I think I'll need to try it out (and shoot a few feet in the process) before I come to a conclusion
15:16
How the heck does closing a browser tab make my laptop freeze -.- Linux is so ridiculously bad at memory management, it's not even funny
browsers are so ridiculously bad at memory management :P
that too
I'm 99% sure Firefox's "minimize memory usage" button does literally nothing
I have read "macros.SIBLING_MACRO - A statement macro where the body of the macro is the next statement is the same block." several times and I cannot parse the two instances of "is"
@Aran-Fey I miss the times of having a real, physical Turbo Button... :(
@Kevin Just write a macro to fix that!
I encountered many a macro in my C++ days and my impression of them is, they're good for amusing tricks like "I implemented DOOM with just marcos", but every practical application would have worked better as a proper language feature
15:31
the bash source code is a good argument against C style macros...
The PEP says as much when it talks about implementing language extensions with macros
As a fan of amusing programmer tricks and proposing weird extensions to existing languages, I would like to have marcos, but I don't want anybody else to have them
Other people can't be trusted not to do dangerous or boring things with them
What's an in short description of a macro?
@MisterMiyagi A place where I worked had an interesting memory management issue. The system ran fine (it was a live report of equipment up/idle/maintenance status), but when you exited the screen, it took forever to clear back to the menu. It turns out this screen built 2 lists about the equipment, and these were built concurrently. In memory, you could see the A list nodes and B list nodes interleaved like ABABABABABABABAB..., and the lists could be long.
It's all fine until it was time to clean up. When the code went to delete the A list, it would free all the A nodes first, giving: .B.B.B.B.B.B.B.B etc. But the memory allocator had to update its free-list for every A node free, so this took a long long time - really sad because the next thing we were going to do was free all those B nodes too.
We switched to a zoned memory allocator where we could say "allocate all these nodes in the same zone" and then to free them, we just deleted the zone. So much winning!
@AshwinPhadke TLDR: it performs a find/replace on your source code before your program runs.
@AshwinPhadke programmatic source code modification
15:36
I'm still not entirely clear what a macro definition looks like. Is it just a function?
Interestingly enough, since we are talking about macros, I implemented my own zone memory allocator in C macros for my own hobby projects.
@Kevin hmm, so I can initialize a macro and then the program will use that value instead of the defined one's
@Kevin the PEP defines them as functions working on AST objects
@MisterMiyagi Isn't all modification programmatic, I mean unless if you mean something at runtime or is it something else?
@PaulMcG your example is my first encounter someone talking about memory management, I have always heard people being like fetch from DB.
@AshwinPhadke "programmatic" as in it is actually part of the program execution. not some separate pre-processor.
15:39
I'm guessing this PEP originates from devs going from C to Python thinking "if only I could do macros in this, it would be so much better" (as devs going from C to any language will do). And like many of us, they are equating "better" with "like I used to do in my previous environment that I was comfortable in".
@MisterMiyagi Yes, plus a kind object, plus a version integer, plus an additional_names tuple-of-strings. I'm wondering whether the programmer will have to define each of these and combine them using existing syntax, or if they'll introduce a new block that does it for you, or what.
@MisterMiyagi Oh thanks.
@PaulMcG my guess was Julia, since they explicitly reference the data science target group.
@Kevin as the PEP says: don't worry, you can define a Macro for that
my day was going better before I realized there was an actual PEP about macros
@Aran-Fey look at the switch-case PEP to relax?
15:44
I'll pass
@Aran-Fey testify!
@AshwinPhadke Yes, nowadays with these newfangled hifalutin garbage-collecting languages, no one worries about memory alloc/free any more!! /me You kids get off my lawn!
gets off the lawn arena
Hmm, trying to decide what "all uses of a macro must be preceded by an explicit import! or from! to improve clarity" means. If it's just saying "you have to import a macro sometime before you use it", well duh, that's how all imports work. If it's saying "you have to import a macro on the line immediately preceding its use, every time", that seems needlessly verbose. If it's saying "you have to import a macro even if you defined it in the same file you're using it in", why?
@PaulMcG lol, I just remember malloc, calloc just a thing I read somewhere and never used
@MisterMiyagi then goes to the house
Is else the correct way to define a action that is not being satisfied by if not ? I mean I am confused here.
15:49
@AshwinPhadke Yeah
Maybe the PEP is saying "much like global, the import! statement executes* before anything else in the block, so in principle you could put it at the end of the block and still access the macros it imports within that block. Like global, we don't want you to do that, so we're making it a syntax error"
@Kevin Thanks.
(*ok, technically global doesn't execute anything, it just indicates to the bytecode compiler where it should look the next time it has to perform a name lookup for that identifier. But you know what I mean)
@Kevin In a twist of irony, the PEP perfectly mirrors my sentiment of macros: People get lazy and write junk, because "there's macros to fix that".
global is simply used to define the scope right? Why would it execute?
Why indeed
15:53
global is one of the few declarations in Python
Some people might look at this code...
x = 1
def foo():
    x = 2
    print(x)
    global x
    print(x)
And think that it prints 2, then 1. Not so.
@Kevin this would make the x inside foo as global I guess?
Back before global-below-variable-use was a syntax error, it would have printed 2, then 2
@Kevin lack of understanding scope , maybe?
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 1
>>> def foo():
...     x = 2
...     print(x)
...     global x
...     print(x)
...
<stdin>:4: SyntaxWarning: name 'x' is assigned to before global declaration
>>> foo()
2
2
15:58
[aphadke@DESKTOP-TP18Q4P cvplay]$ python
Python 3.8.5 (default, Aug 12 2020, 00:00:00)
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 1
>>> def foo():
... x = 2
  File "<stdin>", line 2
    x = 2
    ^
IndentationError: expected an indented block
>>> def foo():
...     x = 2
...     print(x)
...     global x
...     print(x)
...
  File "<stdin>", line 4
SyntaxError: name 'x' is used prior to global declaration
Yep, like I said, it's illegal now
I don't know that I would blame it on a lack of understanding scope... Even if you have a perfect comprehension of normal name resolution rules, if you've never encountered global before, you might assume that it behaves like a normal statement, which would make foo() print 2 and then 1.
The police will show up at your front door any minute now
@Kevin Why would there be such a decision?
@Aran-Fey It's a good placebo though ;)
Because there's no good reason to do it and because it confused newbies in exactly the way I'm describing
16:00
@Kevin The thought process put into this ......
@Kevin I guess global is present in almost all languages, so people might have learned it somewhere.
Is there any way you could do a memory profiling of your python code?
16:18
@GitauHarrison It looks like the migrations that are generated are incorrect. FWIW looking through that question, there seemed to be a whole lot of code that wasn't relevant to the problem but no code showing where you defined the actual Model classes (which is directly correlated to the migrations that would be generated). I really suggest focussing the code in the question
16:29
@Kevin ... in the same block. It's a typo.
@Kevin Macros are imported "into the local namespace" but I don't see anything stopping them from being accessed from inner scopes. I think what he's trying to say is "dotted names aren't allowed for macros" - think of it as similar to function definitions in that sense, you can't def something.name():, can you? The wording is clumsy.
@AshwinPhadke Sometimes you don't want to do anything if the condition is false - then you just don't write the else clause.
16:54
I really wish I could do this
def foo():
    return 1,2

L = []
a, L.append() = foo()

>>> print(a, L)
1, [2]
I wonder if I can do something within a class with @property and decorate it. Seems a little overkill, though
ew no
but yeah, that assignment would trigger a setter
>>> def foo():
...     return 1,2
...
... class PleaseDontDoThis:
...     def __init__(self, wrapped):
...         self.wrapped = wrapped
...
...     @property
...     def append(self):
...         pass
...
...     @append.setter
...     def append(self, rval):
...         self.wrapped.append(rval)
...
... L = []
... a, PleaseDontDoThis(L).append = foo()

>>> L
[2]
homework: make a, *L.extend() = foo() work ;)
@AshwinPhadke You inspired me
quality content
17:14
@PaulMcG I've always wanted to do that with "procs" and "async", with the "s" and "a" on the thumbs. That way, it's "synchronized process" or "asynchronous processes", depending on how I make a fist
I've finally got my brother coding in Python this year. Now he's learning git ...
@holdenweb nice!
We're just discussing whether his nodes, currently represented as dicts, would be better as instances of some class.
17:36
@inspectorG4dget a, *L[len(L):] = foo()
ominous laughing
@MisterMiyagi nice
@MisterMiyagi what sorcery is this?! I love this thing.
18:01
This morning my phone rang for exactly one ring, and then stopped. This afternoon, I arrived at the TPS department's satellite office only to be informed that the TPS processing machine went down that morning, and I would have to reschedule. I now notice that my missed call came from the TPS office.
I like to imagine that the receptionist was trying to call me as the system was self-destructing, and got through for just a second before the entire building was plunged into darkness
Then they're dragged offscreen by a killer robot. Did I mention that the TPS processing machine is about as sophisticated as Skynet?
wim
wim
18:28
@PaulMcG this was stackoverflow.com/questions/64310423/… FYI. help-desk chameleon question
19:21
@MisterMiyagi I would totally use macros to define this behavior
I could even make it work for things like value, measurement_error+ = foo(...)
dear God, someone please stop me. I'm on the road to terribility
@Kevin tell me more. I have a keen interest in things that resemble Skynet. Also, what's TPS?
19:44
hi.
I am relatively new to stack overflow and am not entirely sure about the ways in which the site works. Will I be allowed to ask any questions on this chat, if I am unsure about how a specific thing works? 😃
Of course. For reference, you can read the room rules here
I am trying to create a nested queue class. It has some special (probably weird) functionality. My current code: dpaste.com/8MQN3EYN9 ... This works as intended. I am wondering if I could do it in a better way or if there are any pitfalls I'm falling into or things I'm not considering.
Thank you Aran 🙏 I will definitely read the room rules. I will do so now.
@BožoStojković Since you're popping from the left of self._queues, you should probably consider using a deque instead to improve performance
Hi folks, does someone know how to unittest SSEs (Server-sent events)?
19:53
@Aran-Fey Will do, thanks!
You don't see other problems with the code?
Well, I'm a bit unsure about the purpose of the whole thing. I suspect while len(self._queues) > 1: might be a bug and should be while self._queues: instead, but who knows
@Aran-Fey It's a bit hard to explain. I am trying to create a nested review queue. It would contain indexes of questions that are left for review. At first, I would populate the first sub-queue. As I review the questions, I would assign them some score. Depending on that score, the question will go for re-review to a sub-queue that is further down in the main queue (greater index of sub-queue). As I keep scoring and adding questions, the sub-queues get populated.
When I retrieve questions from queue, I want to get the first one (that is, the first item of first non-empty sub-queue).
As a queue gets empty, it no longer serves any purpose, so it can be deleted. I delete them after popping because there could be questions that are appended before that.
Maybe I'm approaching this thing from the wrong angle, that's why I'm asking the question. :)
Hmm, I still don't see why you need sub-queues. Why isn't a single queue sufficient?
20:10
Oh, right, I completely forgot about one thing. I won't be popping the first item, but a random item. To explain why I need sub-queues: If I deplete sub-queues 1-3, a question in 4th sub-queue should be able to go into sub-queues 5-9, so on.
Anyone familiar with Python module Selenium? Involves web scraping and automation
Hmm, I suppose nesting queues is more convenient than moving around elements in a regular queue
Yeah, picking a random item from sub-queue is essential, which I totally forgot.
Alright then no Selenium experts here lol
If you don't see any further problems, I suppose I can proceed with it. The code just feels odd to me for some reason.
20:15
It certainly is an unusual data structure, but it seems like a suitable tool for the job
It's the only thing I could think of to solve my current problem. Not sure if there is any better way though. :/
Anyway, thank you for reviewing it.
I guess deque goes out of the water since I'm picking random items?
Oh wait, random.sample works with deques
Hmm... I'm not thinking straight anymore. I need some sleep laurel
 
3 hours later…
23:53
@roganjosh I have a user and post model defined. You can check it here dpaste.com/85F33P7LT

« first day (3651 days earlier)      last day (1522 days later) »