« first day (3502 days earlier)      last day (1439 days later) » 
00:00 - 17:0017:00 - 00:00

12:25 AM
Bad news on the boardgames front: BoardGameArena's 'BGA Studio' uses PHP+JS+SQL. Not Python. Haven't found a boardgame site with a Python API yet. Otherwise, BGA is excellent.
 
 
2 hours later…
2:49 AM
Is there an order that default, *args and **kwargs have to go in a function definition?
e.g. I want a function that looks like def myfunc(mynode, myint=5, *args), will that work?
 
Anyone know the best way to plot a list of events that occur within a day? I have csv where each row is a title and a starttime, each event takes 30s and the entire list all occurs within about 24 hours. I mainly want to visualize it so i can see where events are grouped/which ones are stragglers that can be clumped together
 
3:12 AM
@ROODAY excel chart
 
Ill look into that next time, for the time being ive just hacked together a matplotlib plot. Thanks though!
 
I have to say, I don't know whether it came in 3.7 or 3.8 (pretty sure it's recent-ish), but I do love the helpful error messages eg E SyntaxError: unmatched ')'.
 
what did u try to get that error?
 
4:18 AM
@JoshuaVarghese I just had an extra ) eg name = 'some_string')
 
Take a look at Pypy status blog morepypy.blogspot.com/2018/04/…
 
 
1 hour later…
5:35 AM
#simpleThreading program to run just 1 thread other than main thread

import threading
import time

#function
def func():
    for i in range(10):
        print('func: ', i)
        time.sleep(0.1)


#creating thread
t1 = threading.Thread(target = func, name = 't1')

t1.start()
t1.join() #waiting for the thread to end
I have this threading program working properly on Python IDLE but not on command line or when I double click it.
     When I double click it, a window pops up and closes  instantly.
I am using windows 10 and Python 3.8.1
Please help me!!
When I use the command prompt, Attribute error pops up like this -
F:\Pinku\Python_test_programs>py Threading8.py
Traceback (most recent call last):
  File "Threading8.py", line 3, in <module>
    import threading
  File "F:\Pinku\Python_test_programs\threading.py", line 18, in <module>
    t1 = threading.Thread(target = disp1, args = (4,))
AttributeError: partially initialized module 'threading' has no attribute 'Thread' (most likely due to a circular import)
The output on the IDLE window is like this (just as I intend) -
>>>
============= RESTART: F:/Pinku/Python_test_programs/Threading8.py =============
func:  0
func:  1
func:  2
func:  3
func:  4
func:  5
func:  6
func:  7
func:  8
func:  9
>>>
@MisterMiyagi, I am here again, but with greater clarity. Please, help me!!
 
5:58 AM
@Abhijeet.py please don't ping people like that, and don't be needy
 
Sorry, I am new here, and don't know the rules. I will follow them as I will know more. Thanks.
 
@Abhijeet.py the rules are here. "Don't be needy" is not a rule, just a general guidance when you're trying to rely on other people.
 
Ok!
@AndrasDeak I am not a professional, so am I eligible to chat here? (Got to think from the reference you gave to me for rules)
 
Where did you find "only professionals can chat here"?
 
It was written "We are an active and friendly room full of Python professionals and enthusiasts "
 
6:10 AM
Yes, that is what it says.
What it doesn't say is "you can only come here if you're a Python professional"
 
Ok, I understood, thanks.
 
@Abhijeet.py what is the name of your script?
 
Threading8.py?
 
@MisterMiyagi Yes
 
ah, traceback says threading.py
good catch
you also have a threading.py in your directory
 
6:15 AM
@AndrasDeak Yes!
 
I m on mobile right now, barely seeing anything. ^^
 
@Abhijeet.py see sopython.com/canon/96/… . In your case it's not requests.py but threading.py
don't name your files after python modules
 
Ok!
Let me give it a try!
Jolly good!! Its working -
F:\Pinku\Python_test_programs>del threading.py

F:\Pinku\Python_test_programs>py Threading8.py
func:  0
func:  1
func:  2
func:  3
func:  4
func:  5
func:  6
func:  7
func:  8
func:  9

F:\Pinku\Python_test_programs>
Thanks!
Yet another question relating to Tkinter -
I have a program in which I want to hide the console window and just show the Tkinter generated window. I saved with a .pyw extension.
But, it failed to work, and when I selected open with Python Launcher, the console window was still appearing.
Here is the code of the program -
#Starter- file to start the peacock program
#This is version 1.0
import sys
import os

os.system('py "./Program/DecorationResources/BREEZE_PEACOCK.pyw"')
os.system('py "./Program/Initialiser.pyw"')

#file name is PEACOCK.pyw
 
6:40 AM
what is the logic that len function is start counting from 1 ?
 
@roblox it doesn't
check len([])
 
@AndrasDeak then why is len(x) x = [1,2,3]
= 3 ?
 
@roblox Because it has 3 elements.
[] has 0 elements
 
@roblox You have a sack of apples. It contains one Mutsu, one Pink Lady and one Granny Smith. How many apples do you have?
 
@roblox If len doesn't start from 1 but 0, then what will be the length of a sequence that is empty?!
 
7:10 AM
got it guys :)
 
Hi
Let's say I feed a neural network images with a very faint signal, and the signal gradually goes to 0. Is it even possible to feed the model with images where the signal is fainter, than the human perceivable threshold? Because at some point I'm just feeding it noise. So my questions is basically, how can I make sure I still feed a signal and not just noise, if I as a human can't even perceive the signal and it looks like noise to me?
 
I'm not a ML expert but I believe the answer is xkcd.com/1838
 
yeah I know that one, but for real :D It seems like this is an impossible task :D I can see how I can get to human level skill, but how on earth would I go beyond. Because if I can't tell if the answers are right I would need some kind of other model to tell me if they are right, but if I would have one, I wouldn't need to train an ml model in the first place. Hmmm
 
On a more serious note, "human perceivable" can't be any kind of measure. Naively I'd think that if you subtract the original image and scale the result, whether or not the pattern is still there can tell you if it's noise.
 
@Abhijeet.py please always check for error messages. "it failed to work" can mean a lot of things, and instead of everyone trying themselves you can just tell us (and of course yourself).
 
7:23 AM
What do you mean it can't be a measure?
 
Why would a neural network care about human perception?
(apart from the obvious "teach it to see stuff" aspect)
Part of machine learning is to write code that sees things that aren't there. The trick is to make it see something that's actually there, just not obvious. Rather than seeing utter nonsense.
 
I mean the important part is that I want to feed it data with a signal. And I assume there is even signal, if I can't perceive it. But I gotta make sure there is signal and not just noise. I don't want to train a random model
 
You can't "assume there is even a signal" during training, can you?
training is about feeding known truths to your network, at least according to my still-not-a-ML-expert impression
 
I can and did and the output is kinda garbage, so I assume I fed it noise :D
 
Do you have the "signal-less" image?
 
7:28 AM
Yes, I should try to subtract that one
I did that once, but just in a console, was too lazy to incorporate it into the algorithm
 
I hope you're also aware of the concept of "garbage in, garbage out"
 
haha, yes but that is why I'm asking, how to make sure to not garbage in :D
 
That's the crux of the matter. If you can't make sure it's garbage.
 
The thing is its an led sign. I know there is signal, but because of reflection from the sun, the signal might be invisible. So the only measure I have right now is just if I can see it
 
Then that's it. As long as we're talking about training you have to make sure the input makes sense.
 
7:32 AM
Hmm I guess
 
@Hakaishin what kind of signal are we talking about here? If it's just about perception, nö problem. If its about interpretation, why trust the meatbag?
 
And what kind of task I guess? If it's classification or something else it might matter
 
Classification
Basically I tried to train it with the data where I can tell there is signal. It works. Now because of other constraints I want to feed it data with less signal and it doesn't work anymore :P
But I just realized and that is the stupid part of this project. The other constraints are non formal, made by humans. So there is no way to make a good tradeoff. The thing is the other constraints could mean the projects doesn't get implemented or it does, but the boundary of how much we have to satisfy the other constraint is not even clear...
 
I need a deep neural network to understand that sentence
 
I have constraint A and B. B is how good the classification is. I can see that by training my model. A is something else. A is gradual and there is a cut-off after which our solution is unacceptable. I know the big ends of A. Like this works for sure, this doesn't work for sure. But everything inbetween is nill. And the better I fullfill A, the worse B gets and opposite. Now since I don't know stuff about constraint A, it makes fullfilling both constraints overall impossible.
 
7:50 AM
Question: if you have no way to say whether the unclassifiable pictures contain a signal, how do you know there are any unclassifiable pictures that contain a signal?
 
I set the signal of the led light
If I understood your question right, this is the answer :P
 
I understand that you know whether the source of the image contains a signal. I don't understand why you assume this means the image itself contains any signal.
 
8:17 AM
Haha I don't. I assume that there is a range between 0-and signal in image which is below human perceptible. So I thought why throw out data, which the model could use to learn better than a human, just because I can't see it. But yeah, if I can't differentiate between 0 and small signal. I can't be sure I don't feed it garbage. Except for just trying and seeing if it works. But this seems to fail
Also subtracting the base image from them gives the same validation accuracy. It shows that some images are quite noisy, but also that there are faint signals
 
@Hakaishin I would imagine there is a formal approach to putting limits on the model. Similar to when I worked in chromatography, we would get an average baseline and set a Limit of Quantification at some multiple of the baseline. Equally, Siri et al. will default to "I don't know what you just said" than pull from a bag of words it has low confidence in
 
If you know where in the image the signal should be, I assume you could define some threshold based on literal signal to noise ratio.
 
Eh, the tricky part is I don't really know where in the image the signal is
I mean it's roughly centered but not always.
@roganjosh Yes I would love that, have to check how I can make my model less confident. Right now it is super confident 99% of the time. For each image it says 100% some class, but is is wrong :D
I guess it's overfitting
The problem is I used BN to prevent overfit, but because I only train for 3-5 epochs, the moving averages for the BN don't get updated fast enough and I can't use BN
 
:D haha thanks for the paper. Yeah I think in general the problem is hard. But even though I have been told, try to solve it in general, the actual problem we will face, will be probably easier.
 
Hey there guys!
 
Hi
 
Can anyone tell me how to get data in response from django in json array from mysql?
Sorry if i bother you guys, actually i m a newbie in django.
 
I'm not quite sure what you're asking
You want to query MySQL, put the result into some JSON format, and then have django send that back in response to a query?
 
8:48 AM
I need response from Django in json array.
 
Ok, but you mention MySQL. Have you fixed that part of the problem and created the structure of the response?
 
Actually creating that json structure is getting tough for me, although i have got data from MySql.
{
"pickups": [
{
"id": " ",
"name": " ",
"number": " ",
"time": " ",
"status": " "
},
{
"id": " ",
"name": " ",
"time": " ",
"number": " ",
"status": " "
}
]
}
I need to generate the output like above.
 
Well let's focus on bits at a time rather than the whole thing. Do you have some code to share where you process the query results? Please take note of the room rules for longer blocks of code (host them off-site) and the formatting guide if you're posting code here
 
Okay, i will take care of that further.
Well, i am sharing my code.
 
That isn't code. It's the structure that you want for your response
 
8:54 AM
Right dude, i mean i will* share code off-site.
 
9:18 AM
I'm still perturbed by the claim that in 2019 there was no framework for evaluating the resolution capability of image processing algorithms. If it wasn't Nature Communications I'd say that was a sensationalised statement
 
 
1 hour later…
Naz
10:43 AM
cbg, I am trying to get rid of a loop in comments below with a map, with no success. Would a map here improve anything in the first place? I have read that maps are better because it is the C code, whereas a traditional loop would have to be interpreted first
from collections import Counter

class Solution:
    def checkInclusion(self, s1: str, s2: str) -> bool:
        s1n, s2n = len(s1), len(s2)
        if s1n > s2n: return False

        s1_count = Counter(s1)
        s2_count = Counter()

        def update(i: int) -> None:
            print(i)
            nonlocal s2_count, s2
            s2_count[s2[i]] += 1
            return s2_count

        map(update, range(s1n))
        print(list(s2_count))

        for i in range(s1n):
            s2_count[s2[i]] += 1
And you can run it with Solution().checkInclusion("ab", "acba")
 
Is this python 2? In python 3 the line map(update, range(s1n)) does nothing
Either way it's bad code. The purpose of map is to create an iterable, not to call a function for its side effects
 
11:00 AM
@Naz map is as much of a C loop as for. Performance differences are due to scoping, not C.
Can you perhaps explain what your code is supposed to do? At a glance, it seems like you want return Counter(s1) == Counter(s2[:len(s1)]).
 
Naz
understood. oops it is not commented out. the update function is supposed to be equivalent to: for i in range(s1n): s2_count[s2[i]] += 1
 
Yeah, that seems suspiciously close to what Counter(s2[:len(s1)]) does.
Out of curiosity, what result do you expect for Solution().checkInclusion("ab", "acba")?
 
Naz
It is supposed to tell you if a permutation of s1 is in s2. I wrote a solution for this no problem, but was thinking how I can improve the performance further
here is the full code
from collections import Counter


class Solution:
    def checkInclusion(self, s1: str, s2: str) -> bool:
        s1n, s2n = len(s1), len(s2)
        if s1n > s2n: return False

        s1_count = Counter(s1)
        s2_count = Counter()

        for i in range(s1n):
            s2_count[s2[i]] += 1
            if s1_count == s2_count: return True

        for ix in range(s1n, s2n):
            drop_item = s2[ix - s1n]
            if s2_count[drop_item] == 1: del s2_count[drop_item]
            else:                        s2_count[drop_item] -= 1
In linear time
and I was reading about the maps here
what I personally found interesting in that article is that, if you alias function references like: something.do to whatever = something.do (when they are found in for loops), then python does not have to reevaluate them each time and so you get some performance benefits
 
Even with tight loops that I want to run millions of times, I've rarely turned to that optimisation. It's often unbelievably marginal in the gains it gives
 
11:15 AM
There really isn't much point optimising individual lookups here. A builtin solution beats any custom code you can come up with.
 
Naz
I see, so I suppose I should just follow this advice:

```
Get it right.
Test it's right.
Profile if slow.
Optimise.
Repeat from 2.
```
 
That builtin solution is for example return bool(Counter(s1) - Counter(s2))
you might want to read up on multisets
 
No, that doesn't do the same thing. That checks if s1 is a sub(multi)set of s2, not if a permutation of s1 exists in s2
 
Naz
that would not work for s1="abc" and s2="acdbac", for example
you need to account for permutations of s1 in s2
 
This code could use some comments. I'm struggling to figure out what the 2nd for loop is doing
Ok, I figured it out. Comments would've helped though
 
11:21 AM
@Aran-Fey You mean it has to be from a consecutive range in s2?
 
yeah
 
Hm, slicing is needed on top then.
 
Naz
the second loop is a sliding window, it removes the first character (so that we can properly compare to counters later) or decrements the count of the first character. Where first character is the character immediately in front of the sliding window
it then also increments the count of the last character. Where the last character is the last character in the sliding window
 
s1_permutations = Counter(s1)        # all permutations of s1, as a multiset
for end in range(len(s1), len(s2)):  # sliding window over s2
    # multiset overlap => there exists a permutation
    if not (s1_permutations == Counter(s2[end - len(s1):end])):
        return True
return False
 
Now my 25-line solution looks like garbage, thanks
>:I
def checkInclusion(str1: str, str2: str) -> bool:
    len1, len2 = len(str1), len(str2)
    if len1 > len2: return False

    # Take the first len1 characters of str2 and check
    # if they're a permutation of str1
    count1 = Counter(str1)
    count2 = Counter(str2[:len1])

    if count1 == count2: return True

    # Next we'll "slide" the substring of str2 to the right
    # one character at a time.
    for i in range(len1, len2):
        # Drop the leftmost character. Subtracting a dict will
@MisterMiyagi Surely that not shouldn't be there?
 
11:32 AM
Ah, my bad. It's a leftover from the submultiset approach.
Should just be if s1_permutations == Counter(s2[end - len(s1):end]):
@Aran-Fey you can still propose it as a oneliner. ;)
 
def load_config():
global config
configfilename = ".logging/config.ini"
what does the file path mean ".logging/config.ini" ?
 
literally that. it does not have special meaning
 
@roblox please see our code formatting guide for chat and practice in the sandbox if necessary
 
12:34 PM
A simple Google search for ".ini file" turned up the answer.
 
one question about logging, I have created a custom logger and the logs should be logged into
logfilename = conf_logging.get("file", fallback="./logs/%s.log"%__name__)

    logdirname = os.path.dirname(logfilename)
somehow the logs are only printed in the console
do I forgot something ?
 
Well, it doesn't look like you ever configured anything
Those 2 lines certainly don't contain much setup
 
12:52 PM
its a snippet where the logs should be inserted
 
since your problem is with configuring the logger, it would help if you were to show how you configure the logger.
 
@smci anyone with edit access to sopy... I see no problems in adding you to the editor group there if you want?
 
import logging
import logging.handlers


logging.basicConfig(format="%(asctime)-15s - %(name)-20s - %(levelname)s: %(message)s") # configs for logger
logger = logging.getLogger('Root') # root logger

import configparser
import os

config = None

def load_logger():
    # logging
    conf_logging = config["logging"]

    loglevel = conf_logging.get("level", fallback="DEBUG")

    logger.setLevel(loglevel)

    logfilename = conf_logging.get("file", fallback="./logs/%s.log"%__name__)

    logdirname = os.path.dirname(logfilename)
@MisterMiyagi full code
 
well, to start with, logging.getLogger('Root') is not how you get the root logger
other than that, the only problem I see is that you never call load_logger
 
1:10 PM
@Aran-Fey how to get the root logger ?
 
logging.getLogger()
 
Looking for contributions for github.com/analyserdmz/Pyllywood - any contribution is welcome. Thank you!
 
still can not figure it out why I dont get the log in the logfile
for example
def worker():
    try:
        print(2/0)
    except ZeroDivisionError:
        logging.error('Hi from myfunc')


worker()
prints the log only into the console
 
@Naz I would approach this by converting the search string to a predictable permutation - by sorting it. Then run a sliding window of the same size across the search string, and for each position, sort the window contents and compare to the sorted search string.
 
1:26 PM
Hm, I vaguely remember that "sliding window permutations via sort" were already discussed a few weeks back. Also in relation to leetcode. Might have been the same task.
@roblox Have you checked that the file is actually where you expect it to be? Do you use a relative path (as with your fallback) or an absolute one?
 
An MCVE would be kind of useful
 
@MisterMiyagi absolute path , the file is there
@MisterMiyagi I think I got the problem, you can not read log files with the windows editor or ?
 
1:44 PM
Hi guys, you were a great help before. Maybe you can fill in the gaps here too
It's a really simple question, I'm using scipy.sparse.linalg.eigsh to get eigenvalues and vectors of my sparse matrix
The output of the eigenvectors appears to be dimension 2, while my sparse matrix is dimension 4.
 
yes that not posible
 
The call I'm using, is, precisely: eigenX = scipy.sparse.linalg.eigsh(H_matrix, len(Spin_arr), which = 'SA') for example
and then eigenvectors = eigenX[1] for example, but as mentioned the output is different than expected
 
Hi guys,

My installation of Anaconda seems to be very broken. I don't want to fully wipe my system just yet and start again but really don't know how to remove unused enviroments and fix my base environment.

Can anyone help?
(I've been trying to fix this myself and been surfing Stack Overflow questions/answer for months)
(base) C:\Users\JamesMcintyre>conda update anaconda

PackageNotInstalledError: Package is not installed in prefix.
prefix: C:\Users\JamesMcintyre\AppData\Local\Continuum\anaconda3
package name: anaconda
 
Oh I think I found the culprit, it's a shortcoming of Lanczos
Cheers.
 
Hm. Apparently, being able to define async generator expressions in non-async functions was silently allowed somewhen between 3.6.9 and 3.7.1.
I'm torn between rejoicing at these newfound possibilities, and cursing my commitment to older Python versions.
 
2:00 PM
@JamesMcIntyre conda update conda. I'm between phonecalls so I may go quiet, but that's what you need to do. You might also need conda update --all
 
Sorry - had to head into a meeting. Will be back later
 
@JamesMcIntyre you need to be more specific on the issue you're facing and how borked your conda installation is. I've hit a few bumps with conda myself; it seems that, recently, it can get itself into an unworkable state
 
Sam
2:21 PM
Not sure if i'm being stupid here.. is there a clean way to unwrap a key value from a dictionary which only contains one item? I thought I could do something like key, value = mydictionary
 
are you finde with destroying the dict?
 
Sam
Yeah
 
k, v = mydict.popitem()
 
Sam
ahhh i see. Thanks dude
 
if you don't want to restroy the dict, k, v = next(iter(mydict.items())) works
 
Sam
2:27 PM
Perfect, thanks a lot :)
Noted
 
or [[k, v]] = mydict.items(), if you're a psychopath
 
Sam
I wonder how obscure we can make it :)
One strategy to keep a job down i guess
 
Hi,
What should i use to get a file creation time in both windows and linux.
Im using 'getctime' in windows, but it brings the modified time in linux.
 
According to stackoverflow.com/questions/1408272/…, linux doesn't store that kind of data to begin with
The answers other than the top-voted one suggest alternatives that kind of work except when they don't
 
okay
 
2:36 PM
@Aran-Fey nice! wasn't aware we could wrap assignments in arbitrary number of iterables!
Now I need some junk question to recommend [[[[k, v]]]]] = [[[{1:2}.items()]]] as an answer...
 
bonus points for mixing square brackets, parentheses and commas (for single-element tuples)
 
([[[(k, v)]]],) = [([{1:2}.items()],)] is the most evil'ish variant I dared writing, lest the abyss were to look back into myself
@shelby note that file metadata primarily depends on the filesystem, not operating system.
 
I can never remember which kinds of wacky nesting tricks are allowed in 3.X because they made one specific kind illegal during the 2-to-3 fracas, but I always forget what it is
 
you're probably thinking of function parameters. Things like def f(x, (y, z)): used to be allowed
 
@Kevin Unpacking args into tuples, eg lambda (a,b): a * b What Aran-Fey said
 
2:45 PM
@MisterMiyagi okay understood
 
Hmm I think you're both right
 
Yep, it's the same thing. But it tended to get more use with lambdas, since you can't just unpack in a statement.
 
@PM2Ring I miss that one every time I need a sort-key for tuples... :/
 
Same
 
lights a candle for lambda tuple argument unpacking
 
2:48 PM
F
 
I have problem using the '.pyw' extension in python. I saved the following code with .pyw extension and the console gets hidden (as I intended) -# a program to test console hiding using .pyw extension

import tkinter as tk

root = tk.Tk()
root.geometry('500x500')
root.overrideredirect(1)

root.mainloop()
But, the following program 'Peacock123.pyw' is not hiding the console. #Starter- file to start the peacock program
#This is version 1.0
import sys
import os

os.system('py "./Program/DecorationResources/Breeze_Peacock.pyw"')
 
whoa
 
Why are you saving with a .pyw extension?
 
I'm not sure how I borked my conda installation.

I got destperate enough that I've even just tried conda install conda but even then conda update anaconda didn't work.

I'm worried to do conda update --all as many people online seem to suggest that this can break your librarys and I have production Python programs which I need to be able to update.
 
@roganjo Because I want to hide the console window when I double click it.
 
3:00 PM
Saving as .pyw is fairly typical advice for users that want their program to run invisibly (and are windows users? I don't know what the situation is in Linux et al)
 
@JamesMcIntyre it's still the base environment so it won't affect any virtualenvs
 
I am using windows
 
I don't know if this is the cause of your problem, but you should almost never use os.system to start up another python script. The conventional way for one script to run another is to import it.
 
@roganjosh trying conda update --all now...
 
@Kevin But what is the problem with os.system?! And I think importing just results in importing of functions that are no longer needed.
 
3:03 PM
I still get PackageNotInstalledError: Package is not installed in prefix.
prefix: C:\Users\JamesMcintyre\AppData\Local\Continuum\anaconda3
package name: anaconda when I try to do conda update annaconda after the conda update --all

Could the issue be that I get this?:
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
 
Ugh, that's what I was facing a few days back
1 min
2 days ago, by roganjosh
 
Usage of os.system is rare, for one thing because it can be a huge security vulnerability*, and for another thing because the subprocess module is a hundred times more flexible and powerful
(*if you pass it a string that the user has the power to manipulate. Obviously not the case here, but it's worth being paranoid about)
 
I'm not 100% sure about this, but I think the correct advice is "run your script with pyw.exe instead of py.exe", not "rename your file to .pyw"
 
@roganjosh Do you think I should and it would be safe for me to try conda update -n base -c defaults conda --force from that thread then?
 
@JamesMcIntyre I fixed it with conda update --force conda but I'm definitely not sure what I was doing there
 
3:06 PM
renaming your file to .pyw may or may not achieve the same result, depending on what your default program for opening .pyw files is
 
"importing just results in importing of functions that are no longer needed." I don't understand what this means. Surely the functions are needed, or else you would not be trying to run those scripts
 
@Aran-Fey But how can I specify the file should be opened with pyw.exe when I want the user to open it by double clicking it.
 
Or maybe you're saying "after I run Breeze_Peacock.pyw, I would like all of its objects (including functions) to be deallocated before Initialiser.pyw runs". I think you're prematurely optimizing here. Function objects take up, like, a hundred bytes. Your RAM can survive that.
 
I get the below:

CondaValueError: no package names supplied
# If you want to update to a newer version of Anaconda, type:
#
# $ conda update --prefix C:\Users\JamesMcintyre\AppData\Local\Continuum\anaconda3 anaconda



(base) C:\Users\JamesMcintyre

Maybe I should try conda update annaconda --force?
 
@Abhijeet.py What I'm saying is that you're starting the two python scripts incorrectly. You are explicitly running them with py instead of pyw
 
3:09 PM
@JamesMcIntyre what was the exact command that you ran?
 
Or maybe you're saying "If I import Breeze_Peacock, it will dump all of the functions into the global scope and clutter everything up". It will only do that if you do from Breeze_Peacock import *. If you do import Breeze_Peacock, all of the functions will be conveniently encapsulated inside the Breeze_Peacock module object.
 
@Aran-Fey Ok! got your point, let me give it a try
 
I'm very-quickly gonna be out of my depth on this btw @JamesMcIntyre
But it is a legit issue because I was facing it 2 days ago. I just don't want to propagate crap advice :)
 
This is what I typed in and what I got:

(base) C:\Users\JamesMcintyre>update --force conda
'update' is not recognized as an internal or external command,
operable program or batch file.

(base) C:\Users\JamesMcintyre>

(base) C:\Users\JamesMcintyre>conda update --force


WARNING: The --force flag will be removed in a future conda release.
See 'conda update --help' for details about the --force-reinstall
and --clobber flags.



CondaValueError: no package names supplied
# If you want to update to a newer version of Anaconda, type:
 
@Kevin You are getting my point, I want to deallocate everything before everything initialiser starts up freeing all the ram.
 
3:11 PM
Sure, update --force conda --> conda update conda --force. Note the preceding "conda"
 
If you're allocating a huge object inside Breeze_Peacock, do it somewhere other than the global scope (i.e. inside a function), and it will be deallocated automatically by the garbage collector before Initializer begins.
 
shall I try doing what the terminal is saying then and put in?:
conda update --prefix C:\Users\JamesMcintyre\AppData\Local\Continuum\anaconda3 anaconda
 
Or, if the huge object has to be at the global scope for some reason, delete it with del when you're done with it.
 
I would just suggest invoking conda. Your code didn't do that
Open anaconda prompt and type:
conda update --force conda
 
@roganjosh Ahh thanks Rogan. I must have missed that. It's doing "stuff" again now
 
3:15 PM
@Aran-Fey I upgraded the code like this (substituting py with pyw) - #Starter- file to start the peacock program
#This is version 1.0
import sys
import os

os.system('pyw "./Program/DecorationResources/Breeze_Peacock.pyw"')
os.system('pyw "./Program/Initialiser.py"')

The console is still showing up, only one difference, the program does not exit when I close the console by clicking the X button.
 
Still getting this message:

PackageNotInstalledError: Package is not installed in prefix.
prefix: C:\Users\JamesMcintyre\AppData\Local\Continuum\anaconda3
package name: anaconda
 
Because it's not a package
 
@roganjosh I get that when I put in conda update anaconda
 
Anaconda is a distribution, which is Python and about 100 extra libraries pre-installed
 
@Abhijeet.py Hmm. If you remove the os.system calls, does the console still show up?
 
3:18 PM
when I try pip install openpyxl (which I used to have installed), I get:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory:
 
You've cut the traceback off there
 
@Aran-Fey I updated the code like this -                                                     #Starter- file to start the peacock program
#This is version 1.0
import sys
import os
print('Console...')
#os.system('pyw "./Program/DecorationResources/Breeze_Peacock.pyw"')
#os.system('pyw "./Program/Initialiser.py"')
The console is not showing up now
 
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'c:\\users\\jamesmcintyre\\appdata\\local\\continuum\\anaconda3\\lib\\site-packages\\jdcal-1.4.1.dist-info\\METADATA'

I'm now trying conda update -n base -c defaults conda --force as that apparently worked for one of the last people on that github error page
 
ok then I'm out of ideas
 
@JamesMcIntyre I honestly don't know what they borked; I gave you a warning that I'd be rapidly out-of-my-depth and what fixed it for me. It wasn't that command. I think I'm redundant here, sorry
 
3:24 PM
@roganjosh Do you think I'll be able to revert to a working version?
 
Well, I did and I didn't even understand the problem, so it's definitely in the realms of possibility :)
 
@Aran-Fey I upgraded the code like this (using import) - #Starter- file to start the peacock program
#This is version 1.0
import sys
import os

#os.system('pyw "./Program/DecorationResources/Breeze_Peacock.pyw"')
#os.system('pyw "./Program/Initialiser.py"')

sys.path.insert(1,"./Program/DecorationResources/")
import Breeze_Peacock

Now, the console for Breeze_Peacock is hidden. But I am unable to understand why it is now working with the os.system("pyw .....")
There can be one possible reason that I suspect - The os.system maybe starting everything using a command line window, as if we are starting the program by typing "pyw ....." on command line.
 
@roganjosh Can you tell me how you did that please and what version you found works?
 
I already did?
conda update --force conda
 
:(

[Errno 13] Permission denied: 'C:\\Users\\JamesMcintyre\\AppData\\Local\\Continuum\\anaconda3\\Scripts\\conda.exe'
()
 
3:33 PM
Ahaha. I'm sorry to laugh at your misfortune, but my god, why does Windows need to pile another issue on here??
Are you running that in cmd or anaconda prompt?
 
no your right. I think I'm gonna have to restart my computer to try and fix this. I agree that Windows is a pile of crap but unforntuatly I need to use it on my work machine.

Is there a particular version of anaconda you were able to downgrate to which worked?

Yes, running all of this through anaconda prompt
 
@JamesMcIntyre No, because, as I said, Anaconda is a distribution. conda is something different
 
@roganjosh I'm not sure what you mean? What are you suggesting?
 
I'm dispelling the idea that you can downgrade "Anaconda"
 
ahh so you can downgrade "conda" but not "annaconda"?

(base) PS C:\Users\JamesMcintyre> conda update --force conda


WARNING: The --force flag will be removed in a future conda release.
See 'conda update --help' for details about the --force-reinstall
and --clobber flags.


Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

environment location: C:\Users\JamesMcintyre\AppData\Local\Continuum\anaconda3

added / updated specs:
- conda



Proceed ([y]/n)? y
@roganjosh The above is trying it in anaconda powershell prompt instead
 
3:40 PM
hello friends, can anyone point me to any materials that might help me query a rest API in batches I need to process around 800k values and working on a row by row case seems like madness
 
@JamesMcIntyre I'm not sure what you're asking. I'd say accept itt and I'll go to my lawyers to cover my ass if it breaks :P
 
@Datanovice Not really sure what kind of materials you're looking for. Look at the API docs, and if it supports batch requests, then use them.
 
@roganjosh Accept what? I've honestly been trying everything you've been suggesting. Not being mistrustful of you
 
@Aran-Fey @Kevin Now, here is my final update - #Starter- file to start the peacock program
#This is version 1.0
import sys
import os

#os.system('pyw "./Program/DecorationResources/Breeze_Peacock.pyw"')
#os.system('pyw "./Program/Initialiser.py"')

sys.path.insert(1,"./Program/DecorationResources/")
sys.path.insert(2,"./Program/")
import Breeze_Peacock
import Initialiser
Now, all consoles are hidden (as I intend) and I have found that infact the os.system() starts everything up in a new command line window - the reason I wa
 
@Aran-Fey Thanks, I have around 800 thousand addresses of which I need to fetch a long and lat value from the Microsoft Location API I'll have a look into batches
 
3:50 PM
@Datanovice Are you doing this concurrently? Does the API have a rate limit?
 
@MisterMiyagi I'm still researching the best approach from the docs : The following table describes the default service protection API limits enforced per web server within the 5 minute sliding window.

Measure Description Limit per web server
Number of requests The cumulative number of requests made by the user. 6000
Execution time The combined execution time of all requests made by the user. 20 minutes (1200 seconds)
Number of concurrent requests The number of concurrent requests made by the user 52
 
@JamesMcIntyre I was looking at the y/n question for downloads. I'm looking at it on a mobile and I now see that you posted a huge chunk
 
@Datanovice 6000 cummulative requests seems to be significantly lower than 800 000.
 
I'll have to look again in a bit
 
@MisterMiyagi but higher than 1 at a time, 800 k is the total not the batch size, if I could do 6k at a time that would be ideal, just need to figure out how!
 
3:56 PM
6000 / 5min is 20/s. Threads are appropriate for that level of concurrency.
 
Not sure exactly what your refering to here but I have been looking for a solutuions to this for months.

I've solved my issue at least of being able to reinstall openpyxl again.

downgrading my conda from 4.8 to 4.7 and then doing a conda update anaconda to get me back where I started seemed to do the job
 
4:25 PM
Hmm, reviewing my interactions with The Bureaucracy, it looks like I submitted a form in duplicate last week when I was supposed to submit it in triplicate. I should know by this afternoon whether it was mercifully accepted anyway, or if I have to pay $40 for the privilege of starting over.
Hopefully I get it right in the next two tries, which is approximately when The Bureaucracy will process its maximum number of applications, and turn me away forever
 
Perhaps you'll be a happier man when that inevitably happens. A simpler life.
 
4:42 PM
Not impossible, among all conceivable scenarios
30% of my motivation to begin with is to be able to say I tried. I can tick that box whether I succeed or not.
The other 70% is "because I really want the thing at the other end of this red tape"
Empirically, the thing must be worth more to me than $40, but worth less than the effort required to confirm that I photocopied a form the correct number of times
 
Unfortunately the technology to replicate paper-based information does not exist within the bounds of The Bureaucracy, only everywhere outside it.
 
I cannot throw rocks from within my glass house, because on at least one occasion I have close-voted a question for being unclear when I was pretty sure I understood it well enough to answer.
 
well there's always the angle of "I can't believe this is really what you're asking so we must be mistaken"
 
"By submitting only in duplicate, I can only assume that you want me to get two thirds of the way through accepting your application, and then stop"
 
you need a job in government
 
4:54 PM
It irks me that there's no easy way to correctly look up a dundermethod for an instance. Every time I write some_obj.__some_dunder__(), I have this annoying "that's not the correct way to look up dundermethods" thought :I
 
How so?
 
dunders are only looked up on the class, not on the instance itself
 
ah, you know too much
 
cursed knowledge
 
Can't you think of them as class attributes?
 
4:56 PM
I think I understand the distinction being made here, but I'm struggling to imagine a scenario where the difference would matter to me
 
You mean like type(some_obj).__some_dunder__(some_obj)? The problem with that is that it'll incorrectly look up the dundermethod in the metaclass
 
@Aran-Fey no, keeping some_obj.__some_dunder__() but pretending that you're just accessing a regular some_obj.class_attr where class_attr belongs to the class
hacking the wetware
 
sadly I'm no good at pretending
 
though your preceding message suggests that this is not a consistent mental model because some_obj.class_attr should be the same as type(some_obj).class_attr until you shadow the latter with something else on the former
 
00:00 - 17:0017:00 - 00:00

« first day (3502 days earlier)      last day (1439 days later) »