#voice-chat-text-0
1 messages Β· Page 908 of 1
And I made it very complicated for myself
The game itself is not complicated
You just have to not hit the stalactites
and use the spells at the right time (one when is a fire in the way, one when is a big waterball in the way)
But because the size of the stalactites are random, the x and y coordinates have to be changed too and there is no consistent pattern to just make a function for it
So I'm doing the coordinates manually right now
It's a very boring
@rugged root
Oh dude very cool
Yeah, but there are so many combinations
Because the fire has 3 sizes
and the stalagtites have 3 sizes
and the waterballs have 3 sizes
You might talk about it in #game-development. There may be things that they come up with that you may be over complicating
no thanks, I can do this by myself, it's just takes a very long time to do it π
Oh, other good news: You know I had that text based harry potter game. Well one of my classmates liked it, and he was looking for a challenge, so we started to rewrite that program, so I can make a discord bot out of it
MagyarorszΓ‘g
s
sz = s
s = ssh
hello
hai
e
szia
wat birb is that
hmm
You're totally fine asking questions here, but the folks in #career-advice might be able to elaborate on some of this stuff as well
Not at all trying to discourage you from asking here
Oh huh
Rider actually gave me a suggestion where it sees it could reduce nesting a bit
I never would have expected it'd pick up on something like that
yeah visual studio does that too if i remember correcly
atleast its done it to me a couple times
π i use sourcery in vs code so even vs code does that for me in python
Dope
its again an ai based tool tho so always taking ur data
idc really tho
i've just accepted the reality of ai taking over humanity just a matter of time
btw i just noticed freecodecamp just made an intermediate git tutorial so anyone who had just learnt git basics in this server's stream can follow that to learn more
https://www.youtube.com/watch?v=Uszj_k0DGsg
Git has the power to make you a better software developer. But you'll have to go beyond the basic "commit, push, pull" to use it effectively! In this course, we'll look at some of the more advanced concepts and tools to make you more productive and confident with Git.
This course focuses on using Git with the command line.
βοΈ This course was c...
can I try that bot somewhere
I'll add it to my personal server (in my about me) if you wanna try it
pls do
done
How does the what do what now?
π€·ββοΈ
I can hear people - you can't hear me?
@whole bear you trolling me or what? π
Any special requests for Python packages to test with Python 3.10?
ipython, black, flask, and scipy are fails - pytest, coverage, numpy, and requests work
are people talking or is my client broken
sometimes I mute myself and walk away and I need to remember to deafen so people know I can't hear them
What you working on @mortal burrow?
Playing around with SQL and my browser history in firefox.
I'm planning on writing a script to automate the backup of my bookmarks.
So a little bit of data munging/data forensics lol
I'm having fun, just wrote a query to see my browser history in real time.
!voice
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
It happens sometimes that I'm playing around with web server configurations for a website of mine, and I want to temporarily remove the SSL certificate settings. This should be no problem. However, Chrome (and Firefox too for that matter) doesn't like this. Once you've approached your domain using HTTPS, it
yo could someone possibly help my friend in #help-donut
im trying to help this guy but we cant seem to get it
result["network_visit_id"] = network_visit_id
result["network_visit_id_approx"] = approximate_id(network_visit_id)
pageview_id = build_page_view_id(record)
result["page_view_id"] = pageview_id
result["page_view_id_approx"] = approximate_id(pageview_id)
visitor_id = get_visitor_id(record)
result["visitor_id"] = visitor_id
result["visitor_id_approx"] = approximate_id(visitor_id)
family_visit_id = build_family_visit_id(record)
result["family_visit_id"] = family_visit_id
result["family_visit_id_approx"] = approximate_id(family_visit_id)
job_view_id = build_job_view_id(record)
result["job_view_id"] = job_view_id
result["job_view_id_approx"] = approximate_id(job_view_id)
site_visit_id = build_site_visit_id(record)
result["site_visit_id"] = site_visit_id
result["site_visit_id_approx"] = approximate_id(site_visit_id)
^ Imagine this, but it's a monolithic codebase
^ & you're not allowed to touch it
Boop.
There's lot's of ppl in here @opaque coral. Talking about replit atm
@wind raptor check my about i want review of my yt channel
@wind raptor any content suggestion...?
!u

Created: <t:1580002257:R>
Profile: @dense ibex
ID: 670802831678373908
Joined: <t:1609774606:R>
Roles: <@&267630620367257601>, <@&585529568383860737>, <@&764245844798079016>, <@&764802720779337729>, <@&463658397560995840>, <@&542431903886606399>
Total: 4
Active: 0
!u
You are not allowed to use that command here. Please use the #bot-commands channel instead.
:(
@rugged root it's crazy, the vc is active without you in it!
vs π³οΈββ§οΈ

"The internet is a really trustworthy place." Oh boy. That's adorable.
Almost every day
scene one
load "main.mp4"
after 0:01 layer 1 load "file.png"
visible for 0:05
x animate from 7 to 4 over 0:03 starting now
after one scene two
load "aux.mp4"
Hi
!eval```
if choice == '2':
print ("1.Make an New List")
print ("2.Check your Lists")
print ("3.Edit your lists")
print ("Close")```
!e
if choice == '2':
print ("1.Make an New List")
print ("2.Check your Lists")
print ("3.Edit your lists")
print ("Close")```
!e
if choice == '2':
print ("1.Make an New List")
print ("2.Check your Lists")
print ("3.Edit your lists")
print ("Close")```
@sinful igloo :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | print ("3.Edit your lists")
003 | ^
004 | IndentationError: unindent does not match any outer indentation level
what is this?
a toy language ive been thinking up
ohk
hi guys
hlo
how to get verification?
just stay in the server for 3 days
along with 50 non spam messages
Hi @vast pebble
hi
I have been doing python for 3 months but I have programmed for 4 years
Mostly C in university but I made a project in JS
Thats cool! Any idea for the game or are you still coming up with ideas
ok sure
its nice man
yo
why can't i talk? is there like a certain quota i have to reach to have access to use my mic in vc?
because if so that sucks. but hey i understand why
well gl with what ever you code
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
thanks
sup @zenith radish π
wait how many people are in this vc?
i heard 2 voices
mate
im restarting my discord
sup Lizzie π
i can see you in the vc now in my client xD
macOs goes brr
is using rust for backend and python for frontend in datascience a good option?
:0
like not backend backend
i dont mean server side
i mean library side like how tensorflow was built with c++?
is go good for server side or node js with express kinda lib?
i wanna give go a go
xD
seriously tho, is go good for serverside backend?
cool beans
so what you coding?
does go have good integration with nodejs?
cool
why π¦
would be nice if there was like a scratch style coding but for python
@whole bear share it π¦
connect it alreadyyyy
OH NO
MY BACK
im not running this mate
xD
its cool tho
yeah
@zenith radish , im installing your configs π do i have permission to ping you if something screws up mate?
yay xD
yup
gitautus?
that must be you right>
i screw links all the time
oh haha
what do i do?
im new to emacs hehe, would that be located in config.el?
Thanks!!
which is your leader btw?
SPC
!goto mines
When checking if something is equal to one thing or another, you might think that this is possible:
if favorite_fruit == 'grapefruit' or 'lemon':
print("That's a weird favorite fruit to have.")
While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.
So, if you want to check if something is equal to one thing or another, there are two common ways:
# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
print("That's a weird favorite fruit to have.")
# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
print("That's a weird favorite fruit to have.")
like is that disabled in your configs?
just my opinion but at the point where someone's trying to make a game to work in discord instead of just making a separate proper game in my mine he's already a 12-13 year old and i expect worst looking code already
again just my opinion
!voice
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
that weird
Now maintained here: https://github.com/aristotlepenguin/endless-war - GitHub - magicksRampage/endless-war: Now maintained here: https://github.com/aristotlepenguin/endless-war
let's go fight C++ oohhhh
@zenith radish how do i get the menu to pop up when i press on SPC?
it should work for ya
you can mv ~/.doom.d ~/.doom.old && git clone myconfig.git
and try again
i did dis
i get this
still the same
what the heck
func F() <-chan int {}
@zenith radish i just got confused because i thought you're assigning a read only channel ^
var myChannel chan int
<-myChannel
replaces
the <-myChannel with the next value gotten through the channel
<-chan int
^ while this is a read-only channel type need to remember this :x
i think this is the 4th time i've forgotten it
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
@whole bear
β€οΈ
class MyClass:
def __init__(self, a, b, c, *e):
...
bag = ["candy" for _ in range(30)]
MyClass(*bag)```
i heard opal where he is
...Are you hiding in my ceiling?
opal where are u
Come down out of my ceiling and see for yourself.
all this data (from multiple pages) took 1.2 seconds without goroutines even o-o
golang fast even without go routines man
lol
comeon i can hear u but cant see ur icon
Ahhh. Discord's servers have been misbehaving.
hey@rugged root
Cache update issues maybe.
oh isee
π¦ Sorry to hear that Hemlock. Hope things get better for you.
Face... face.... I'm trying so hard rn
?
trying to be punny π¦
Ah.
*fail miserably
At least you've faced up to your failure.
Which you could have got away with if you hadn't said anything, so it wasn't that bad. π
Thanks opal π₯²
π i used to have friends and party but ever since i started actually trying to get good at programming i've lost all friends
not lost just don't hang out with em
monke
oh my gosyh\
@rugged root π¬
π i've spent majority of my school days playing soccer yet for me the only major physical injury i've had is playing cricket the one time i played it i literally did a front flip and landed on my right hand and it cracked... and then i kept playing soccer for next 3 days without noticing it xD
I remember this scene from house of wax where the bad guy cut one of the character's achilles tendon. That's how I learned the word "achilles tendon".
https://www.youtube.com/watch?v=fLzF0PTrwE4 this one's my favourite pimple popper video
Joshua Jacksonville.
meanwhile me: gets freaked out by ants
Tankles.
only me cuz i hate all insects xD
i can't even with butterflies
sem
They're butterflies. They're about the most harmless insect in the entire kingdom.
i am weird in that regard i'm dehydrated half the day and drink too much water the other half
but. they're. INSECTS. D:
I mean they're pretty.... a metre away...but when they're in front of ur face u can see all the details and the legs
yeah the point isn't that its harmful but that its a small creepy organism
I think they're lovely.
when you look at them from far yeah
i only have useless skills other than programming myself
I have dreams of becoming an illustrator but coding is all I do these days
it's not bad tho. I like coding too.
Your feelings about yourself do not hold authority over the feelings other people have about you.
brb
list of useless skills i have
soccer: haven't played in years and i'm a bit fat now
speedcubing: i don't even find it fun anymore
gaming: i rarely play games now and its mostly rocket league
roller skating: no space for it around
sewing: again touched haven't in years probably suck at it now
Years ago, I went into a butterfly enclosure at a zoo. It was wonderful.
i would say which os you like is really just preference now. windows used to suck but i'd say with wsl and windows terminal and powershell core i like it more than mac personally
linux > windows > mac for me
Bitcoin cosmetics. Accentuate your natural beauty with the latest in crypto mining technologies.
I did theater too π
Romeo, Romeo...Row me, oh, like a paddleboat, ho.
π oh my gosh
"I hope you find happiness like Rabbit did."
"You are a terrible person. That's what it says right here. 'A terrible person.' We weren't even testing for that."
now with cutting-edge AI personalisation
I think I'm gonna be here alll night ... π¦ I was being stupid all week and procrastinated now I have 40 assignments to mark due TOMARRAW
i need to do loads of work
but can't concentrate cuz the neighbours are drilling
Well that was silly, wasn't it? π
rubbing it in, huh
@whole bear when covid has died down a bit attend conferences for your preferred language
you learn + you get to meet real life friends with similar intrests its a win-win
yes and I regret my bad decisions π¦
baaad neighbour >:O
i know alooot of ppl who wanna live in like country-side or just closer to nature
i myself don't get the appeal i would much rather stay in the polluted convenient city i already am in
The whole lack of FDA approval excuse is/was such a fucking fig leaf.
it makes more noise
unfortunately
Example of setting the user agent using requests, stolen from a work project:
# K-ERP forces you to use Firefox
HEADERS: typing.Final[dict[str, str]] = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0',
}
response = requests.post(BULK_SEARCH_URL, headers=HEADERS, params=params, data=data)
Good evening
Just continuing my research from last night
Ended up getting kind of stumped but I found some talk slides https://github.com/willtim/recursion-schemes
So I'm kind of just, synthesizing three different sources into a single product
I think I really should take a break
good girl π
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
i'mma go join the workshop cuz free knowledge maybe i'd find something i don't know yet xD
!code
yup
I'm a zoomer 
millenial too
It really just means I have a crippling, pessimistic world view because I probably won't live to see the future because of global warming
I tried fate recently a wee bit different than dnd
anyhow good night guys
or have a nice day
wherever u are
hi
cat
aww
import datetime, asyncio, websocket, json, numpy
import pandas as pd
import pandas_ta as ta
from binance.client import Client
import websocket, json
binance_api_key = 'xxx'
binance_api_secret = 'xxx'
client = Client(api_key=binance_api_key, api_secret=binance_api_secret)
from multiprocessing.pool import ThreadPool as Pool
daysneeded = 200
pool_size = 10
symbols = ['ADAUSDT', 'ATOMUSDT', 'BATUSDT', 'BTTUSDT', 'DASHUSDT', 'DOGEUSDT', 'EOSUSDT', 'ETCUSDT', 'ICXUSDT', 'IOTAUSDT', 'NEOUSDT', 'OMGUSDT', 'ONTUSDT', 'QTUMUSDT', 'TRXUSDT', 'VETUSDT', 'XLMUSDT', 'XMRUSDT' ]
def num_to_month(*args, **kwargs):
num = kwargs.get("num", None)
if int(num) <= 12 and int(num) > 0:
list_of_months = {'01': 'Jan', '02': 'Feb', '03': 'Mar',
'04': 'Apr', '05': 'May', '06': 'Jun', '07': 'Jul',
'08': 'Aug', '09': 'Sep', '10': 'Oct',
'11': 'Nov', '12': 'Dec'}
return list_of_months[num]
def from_date():
global fromdate
fromdate = str(datetime.datetime.now() - datetime.timedelta(days=daysneeded))
fromdate = fromdate.split()
fromdate = fromdate[0].split("-")
month = num_to_month(num=str(f'{fromdate[1]}'))
fromdate = f'{fromdate[2]} {month}, {fromdate[0]}'
def to_date():
global todate
todate = str(datetime.datetime.now() - datetime.timedelta(days=daysneeded))
todate = todate.split()
todate = todate[0].split("-")
month = num_to_month(num=str(f'{todate[1]}'))
todate = f'{todate[2]} {month}, {todate[0]}'
from_date()
to_date()
org_columns = ['open',
'high', 'low', 'close', 'volume', 'close_time', 'quote_av',
'trades', 'tb_base_av', 'tb_quote_av', 'ignore']
def worker(symbol):
try:
klines = client.get_historical_klines((symbol), Client.KLINE_INTERVAL_5MINUTE, fromdate, todate )
klines_len = len(klines)
if klines_len == 0:
print('Failed to download data for ', (symbol))
new_columns = [item for item in org_columns]
new_columns.insert(0, 'timestamp')
DF = pd.DataFrame(klines,
columns=new_columns)
DF['timestamp'] = pd.to_datetime(DF['timestamp'], unit='ms')
DF.set_index('timestamp', inplace=True)
DF.to_csv(symbol)
except:
print('*** Invaled symbol:', (symbol), '! ***')
pool = Pool(pool_size)
async def testLoop():
for symbol in symbols:
pool.apply_async(worker, (symbol,))
pool.close()
pool.join()
loop = asyncio.get_event_loop()
loop.run_until_complete(testLoop())
there is great module called futures and it has process/thread pool executors
great stuff
i had a bagel and am too full :(
I'm doing this mini challenge, and have this code so far, but am unsure what to do, could someone explain what I should - in vc/chat
don't randomly ping people, I don't even use voice chat
srry
@rugged root https://www.youtube.com/watch?v=jXy6YCpJnQM
Track: 1
Label: KUSEMONO RECORDS
EP: Oracle
Release date: February 1, 2016
Format: Digital
Enjoy!
Bandcamp:
https://cysmix.bandcamp.com/album/oracle
i-Tunes (JP):
https://t.co/EVDt5RF88H
cYsmix:
http://cysmix.bandcamp.com/
https://www.youtube.com/user/cYsmix
https://soundcloud.com/olemlanglie
https://www.facebook.com/cYsmix
https:/...
ΠΠ΅ΡΠ΅Π·Π°Π»ΠΈΠ² Π²ΠΈΠ΄Π΅ΠΎ ΠΈΠ· ΠΌΠΎΠ΅Π³ΠΎ ΠΈΠ½ΡΡΠ°Π³ΡΠ°ΠΌΠ° Π² HD ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅.
ΠΠ° Π²ΠΈΠ΄Π΅ΠΎ ΡΠ°ΠΊ ΠΆΠ΅ ΠΏΡΠΈΡΡΡΡΡΠ²ΡΡΡ:
https://www.instagram.com/johngradei
https://www.instagram.com/tim_tkachenko_c
ΠΠ£ΠΠΠ’Π¬ Π’Π ΠΠ ΠΠΠΠΠ ΠΠΠΠ‘Π¬:
https://satanenko.bandcamp.com/album/-
ΠΠΠ‘ΠΠ£Π¨ΠΠ’Π¬ ΠΠΠ Π ΠΠΠΠΠ‘ ΠΠΠΠΠ ΠΠΠΠ‘Π¬:
https://soundcloud.com/repenie/animal-religion-gospod-iisus-khristos
ΠΠΎΠΉ ΠΈΠ½ΡΡΠ°Π³ΡΠ°ΠΌ/My...
@slim arch i donno if u got it yet but
flattern = ([[1, 2], [3, 4]])
flattern = str(flattern)
flattern = flattern.replace("[","").replace("]","").replace(" ","").split(',')
print(flattern)
that's horrible
oh no
i donno how els to do it π¦
it also doesn't work if you have strings with spaces or "[" or "]"
or commas
for two levels of nesting the easiest way is itertools.chain.from_iterable
oh, and the most egregious error, you now have to convert all you data back to what it was, and that's not necessarily possible
@rugged root https://soundcloud.com/l-plo-l/troubles-cleaning
yeah no
thanks for trying though lmao
thats just going to make me 10000x more confused
for me if it functions i don't need new
mobile if i can call with it then it works
car if it can drive and is road legal it works
laptop its barely holding on but it meets my programing needs so it works
@rugged root π
can you show your current code
def flatten(numbers):
result = []
for sets in numbers:
set1 = numbers[1]
set2 = numbers[2]
for numbers in set1:
number1 = set1[1]
number2 = set1[2]
for numbers in set2:
number3 = set2[3]
number4 = set2[4]
result.append(number1)
result.append(number2)
result.append(number3)
result.append(number4)
print(result)
return result
flatten([[1,2],[3,4]])
i got super confused
most of it is crap
you can just do a nested loop
outer to loop over the lists, and inner to loop over the elements in the list
https://www.vim.org/download.php#pc
if that doesn't work
vim
" exit without save
ZQ
:q!
" exit with save
ZZ
:wq
" how to navigate
h " left by 1 char
j " down by 1 line
k " up by 1 char
l " right by 1 char
w " go to the start of the next word
e " go to end of the current or next word
b " go to the start of a previous or current word
2j " adding numbers to normal mode commands like this makes them repeat so this goes down 2 lines
:<line-no> " just need a line number to jump to specific line number
x " delete 1 character
dw " delete till start of the next word
de " delete till end of the current word
dd " delete line
zz " center current line on screen
zt " take current line to the top
zb " take current line to bottom
i give up trying to explain vimscript (i use em but idk how to explain) and norm commands so here's the basics
:%norm dd
^ delete all lines for example
Hey!
ikr that's the cutest voice i've heard in a while
@zenith radish i'm actually just gonna straightup try emacs with evil mode rn so... what lsp do you use again?
brew install tesseract
whereis tesseract
@whole bear
@woeful salmon https://github.com/hlissner/doom-emacs
sudo add-apt-repository ppa:kelleyk/emacs
sudo apt update
sudo apt install emacs27
@dire folio why do you need 3tb of SSD space?
Or really any of your specs?
How many tabs do you currently have open...
204
Having more than three bothers me haha
@dire folio https://github.com/NvChad/NvChad
@dire folio https://github.com/neovide/neovide
sn3k'; DROP TABLE jakes_data; --
What if Jake isn't really jake and we are all being fooled?
@dense ibex https://nixos.org/
discord taking forever to connect lol
@vivid palm I dig the piss colour role
Rip
I've been in the vc for like an hour and I don't think hemlock knows I'm here lol
aw lol
:p
jake if your piss is this color drink more water
@dire folio
Hey where did the exploding pandas go Mina?
Ahh
Anyways I'm going to go, I'll be back later
from datetime import datetime, timedelta
from collections import OrderedDict
dates = ["2000-1-1", "2020-12-31"]
start, end = [datetime.strptime(_, "%Y-%m-%d") for _ in dates]
dates = OrderedDict(((start + timedelta(_)).strftime(r"%b-%d-%y"), None) for _ in range((end - start).days)).keys()
for i in dates:
print(i)
prints in format
Sept-30-20
i want it to print something like
september-3-2020
how would i do that?
from scipy import signal
import matplotlib.pyplot as plot
import numpy as np
def binary_counter(switch, rangeSize, invert = True, prefix = ''):
arr = []
on = True
for i in range(rangeSize):
if(i % switch == 0):
on = not on
if invert:
if on: arr.append(0)
else: arr.append(1)
else:
if on: arr.append(1)
else: arr.append(0)
print(prefix, arr)
return arr
a = binary_counter(8, 16, False, prefix='a :')
b = binary_counter(4, 16, False, prefix='b :')
c = binary_counter(2, 16, False, prefix='c :')
d = binary_counter(1, 16, False, prefix='d :')
F = [0 for i in range(len(a))]
for i in range(len(a)):
F[i] = b[i] & ~c[i] | c[i] & d[i] & a[i]
print(f"F : {F}")
t = [i + 1 for i in range(16)]
plot.plot(t, a)
plot.title('F = bc\' + acd')
plot.xlabel('t')
plot.ylabel('a')
plot.axhline(y=0, color='k')
plot.grid(True, which='both')
plot.show()
@rocky kiln I thought they wanted the graph flipped some way π
plot.plot(t, b, draw_style="step")
π
Hello π
What are you working on?
Oh right nice. So you're running some automated tests/linting?
Right π
Ah right
Sounds like you've got it figured out
Oh yeah right.
The logs are definitely a nice feature. And I like how we're able to have internal conversations.
Although sometimes I do accidentally send internal messages to the recipient π
Erm, I think you can do that Β―_(γ)_/Β―
Are you using discord.py for this?
Fair enough
Hello
Erm, post the question here @loud raptor
Oh, hello @somber heath. I didn't see you were in here π
#Reads songs added so it saves to the program
def ReadSongsFromFile():
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
return json_songs
#Add songs to Json file to be read and checks if file or path aready exists so it doesn't duplicate
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True
#adds songs to program from Json file
def AddSongsFromJson():
AllSongs = ReadSongsFromFile()
for song in AllSongs:
songname = mp3file(song['name'], song['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
What does the file look like?
def DeleteSong():
Stop()
if songBox.delete(ANCHOR) == True:
pygame.mixer.music.stop()
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for i in range(len(json_songs)):
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
if json_songs['name'] == songBox.delete(ANCHOR):
del json_songs[i]```
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 225, in DeleteSong
if json_songs['name'] == songBox.delete(ANCHOR):
TypeError: list indices must be integers or slices, not str```
Hmm, you do have the same file open for reading and writing at the same time.
It's generally best to load the whole file, make the desired changes to the data, then save the entire file back to disk.
if json_songs[1] == songBox.delete(ANCHOR):
pass
I think there's an argument for sql.
Can you post a section of the json file so we can better understand?
Use https://paste.pythondiscord.com, if it's a long file.
with open("data.json", "r") as file:
data = json.load(file)
#operate on data
with open("data.json", "w") as file:
json.dump(data, file)```
Alright, so the json file is a list of songs (each song being an object/dict with a name attribute), and you have the name of a song which you want to delete?
yea on my program
Once you load the json file, you have a list. You need to remove the named song from that list, then write the list back to the file.
yea but idk how i would do that
It might actually be easier to create a new list sans the song.
what?
Taking this as a starting point.
data is the list.
yea
So you want to do something like ```py
data_sans_song = []
for song in data:
if song['name'] == target_name:
continue # Skip songs with matching names.
data_sans_song.append(song)
in the deletesong() function?
Yep
ok
And then you'd write data_sans_song back to the file.
Do you feel you understand what this code is doing?
its appending a song name to the list if it matches whatever the target is
Yeah. Have you seen the continue keyword before?
i never really used it
before
what am i using for the target name tho? im a bit confused
Right. So that would be the name of the song you want to delete.
If the name of the song matches, we skip that song (don't append it to the new list).
continue just skips to the beginning of the next iteration of the loop.
so like this
Stop()
SongData = []
with open('songs.json', 'r') as json_songs_file:
json_songs = json.load(json_songs_file)
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
for song in json_songs:
if song.name == json_songs['name']:
continue
SongData.append(song)```
When I wrote song.name, I meant song['name']. Sorry if that caused confusion.
now for some reason nothing appended to the Json file when i import mp3 files to my program
This isn't quite right.
i didnt change anything
The logic of the function would be:
- Load the json file.
- Create a new list with all the songs except the song you want to delete.
- Write the new list back to the json file.
ohh ok
wait i think someone edited my code on github
that i added a friend
give me one sec
Where are you getting the name of the song to be deleted from?
from my program
There should be a "blame" button somewhere.
@loud raptor If you open a file on GitHub, you can view its history:
for some reason now, my program isn't appending anything to the JSON file now when i import songs to the program
@haughty pier good nickname
idk why when it was working during the week
what's the killer feature of NixOS, current or future
i didnt change anything with the functions tho
now for some reason importing mp3 files is not working properly
@stuck furnace
Erm, I'm not familiar enough with your code to help you with this sorry.
Is this a group project?
no but the i had a guy help me append stuff to the JSON file from this discord
he helped with all the JSON management i have at the moment but for some reason, the functions dont work now when i didnt touch them
like nothing is being appended to the JSON file at all
After changing the DeleteSong function?
let me see
nah i reset eveything and still not working
wtf is happening now
idk what is happening now
Are you able to ask your teacher for help/feedback?
nah the teacher can't help with this project
im calling this function
#adds songs to program from Json file
def AddSongsFromJson():
AllSongs = ReadSongsFromFile()
for song in AllSongs:
songname = mp3file(song['name'], song['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
what are you making a music bot?
mhm nice
and it's pissing me off as it stopped working properly with no changes to functions
AddSongsFromJson()
# Run the Main Loop
root.config(bg = "cadetblue2")
root.mainloop()```
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True```
@stuck furnace this is correct right?
That doesn't appear to add the song to json_songs at any point.
Somewhere in there you need the line json_songs.append(song)
it was working this week tho
i have this though
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)```
because i dont want to add duplicates in my Json file
its checking also for duplicate names
That will write to contents of json_songs back to the file, but at no point did you append the song to json_songs.
I don't know enough about your code/project to say, sorry.
ill try that
I also have to go to bed.
oh ok goodnight
Erm, I would really recommend talking to your instructor, as I feel like you're tying yourself into knots a bit with this.
Could you ask to simplify the requirements of the project?
well im trying to get the most basic functions of a music player to work
at the very least
so deleting, skipping, playing, shuffling, and fast fowarding
i did have other stuff i wanted to add but ill do it after i finish school
like trying to make graphs and stuff depending how much you listen to in a week
something like that
Alright. The key thing is to understand what you're doing at each step. If you can't write out the steps of the function in pseudocode, you are going to have issues writing the actual code.
I was trying to use voice chat
nothing is still appending when i did json_songs.append(song)
Having issues with permission
Hey @chilly dragon , see #voice-verification for details.
You should meet the requirements to verify.
The order of the lines matter. What does the function look like after adding this line?
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
else:
json_songs.append(song)
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True```
@stuck furnace
I would put json_songs.append(song) after the loop.
Gtg π
if song['name'] == json_songs['name']:
TypeError: list indices must be integers or slices, not str```
#Delete a song function
def DeleteSong():
Stop()
with open('songs.json', 'r') as json_songs_file:
json_songs = json.load(json_songs_file)```
What is everybody's time zones?
AEST
Ah that explains it
EDT
class mp3file:
def __init__(self, mp3filename, mp3dir):
self.mp3filename = mp3filename #Object that gets just the file name
self.mp3dir = mp3dir #object that gets just the file directory```
def AddManySongs():
songs = filedialog.askopenfilenames(title = "Choose an MP3 file", filetypes = (("mp3 Files", "*.mp3"), ))
#Loop through song list and replace directory and mp3
for song in songs:
song_dict = {}
song_dict['name'] = os.path.basename(song)
song_dict['path'] = os.path.abspath(song)
if AddSongtoFile(song_dict):
songname = mp3file(song_dict['name'], song_dict['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
I'm reminded of how huge the americas are. Where I'm from it's the same timezone anywhere in the country π
#Add songs to Json file to be read and checks if file or path aready exists so it doesn't duplicate
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
json_songs.append(song)
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True```
mp3list.append(songname)
π³
sorry @frosty star
its ok
i was silently giggling behind the screen
so it's finee
brackets, square brackets, curly braces, colons, semi colons, triple-quoted strings, parenthesis
Good afternoon opal
def DeleteSong(song: mp3file):
songBox.delete(ANCHOR)
!e py class MyClass: ... a = MyClass() b = {"a":"b"} print(type(a), type(b))
@somber heath :white_check_mark: Your eval job has completed with return code 0.
<class '__main__.MyClass'> <class 'dict'>
!voiceverify
songBox.insert(END, songname.mp3filename)
mp3list.remove(song)
#Create playlist box
songBox = Listbox(MasterFrame, bg = "black", fg = "magenta2", width = 60, selectbackground = "gray", selectforeground = "black" )
songBox.grid(row = 0, column = 0)```
def DeleteSong(song:mp3file):
Stop()
mp3list.remove(song)
with open('songs.json', 'w') as json_songs_file:
json_songs = json.dump(json_songs_file)```
36 assignments marked, 20 more to go fml
def DeleteSong(song:mp3file):
Stop()
mp3list.remove(song)
with open('songs.json', 'w') as json_songs_file:
json.dump(json_songs_file)```
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
json_songs.append(song)
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True```
``py
json.load(json_songs_file)```
json.dump(your_data, json_songs_file)
with open("data.json", "r") as file:
data = json.load(file)
#operate on data
with open("data.json", "w") as file:
json.dump(data, file)β```
PS C:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program>```
def DeleteSong(song:mp3file):
Stop()
mp3list.remove(song)
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)
```
RemoveSongMenu.add_command(label = "Delete a song from list", command = DeleteSong)```
songBox.delete(ANCHOR)
#Create actual buttons
backButton = tk.Button(controls, image = backImage, borderwidth = 0, command = PreviousSong)
skipButton = tk.Button(controls, image = skipImage, borderwidth = 0, command = NextSong)
playButton = tk.Button(controls, image = playImage, borderwidth = 0, command = play)
pauseButton = tk.Button(controls, image = pauseImage, borderwidth = 0, command = lambda: pause(paused))
stopButton = tk.Button(controls, image = stopImage, borderwidth = 0, command = Stop)```
Menus: Part of a Modern Tk Tutorial for Python, Tcl, Ruby, and Perl
menu_recent.add_command(label=os.path.basename(f), command=lambda f=f: openFile(f))
RemoveSongMenu.add_command(label = "Delete a song from list", command = DeleteSong)```
so how would i use lamda to get the function to work @chilly dragon
the command parameter can be a lamda function
yea but what do i put in parenthesis?
lambda funcs take an argument and an expression
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 309, in <lambda>
RemoveSongMenu.add_command(label = "Delete a song from list", command = lambda: DeleteSong())
TypeError: DeleteSong() missing 1 required positional argument: 'song'```
@chilly dragon
RemoveSongMenu.add_command(label = "Delete a song from list", command = lambda: DeleteSong())```
im so confused
me too π
so what am i puttiing in the delete function?
#Delete a song function
def DeleteSong(song:mp3file):
Stop()
mp3list.remove(song)
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)```
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
TypeError: <lambda>() missing 1 required positional argument: 'song'```
RemoveSongMenu.add_command(label = "Delete a song from list", command = lambda song: DeleteSong(song))```
#Delete a song function
def DeleteSong(song:mp3file):
Stop()
songBox.delete(ANCHOR)
if songBox.delete(ANCHOR) == True:
mp3list.remove(song)
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)```
#Delete a song function
def DeleteSong(song:mp3file):
Stop()
songBox.delete(ANCHOR)
if songBox.delete(ANCHOR) == True:
mp3list.remove(song)
pygame.mixer.music.stop()
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)```
pauseButton = tk.Button(controls, image = pauseImage, borderwidth = 0, command = lambda: pause(paused))```
#Pause and unpause the current song
def pause(is_paused):
global paused
paused = is_paused
if paused:
pygame.mixer.music.unpause()
paused = False
else:
pygame.mixer.music.pause()
paused = True```
command = lambda: DeleteSong(song))
func:
xor eax, eax
mov eax, 10
add eax, 5
ret ;// essentially identical to: pop [register] -> jmp [register]
_start:
call func
mov ebx, eax ;// Address of this instruction is pushed onto the stack
;// ebx is now 15
.model small
.data
msg db 10d,13d,"Hello World$"
.code
mov ax,@data
mov ds,ax
lea dx,msg
mov ah,09h
int 21h
mov ah,4ch
int 21h
end```
lambda: DeleteSong(selected_song)
command = lambda song: DeleteSong(song)
@wind raptor ^ this
def AddSongsFromJson():
AllSongs = ReadSongsFromFile()
for song in AllSongs:
songname = mp3file(song['name'], song['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
#Reads songs added so it saves to the program
def ReadSongsFromFile():
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
return json_songs```
#Add songs to Json file to be read and checks if file or path aready exists so it doesn't duplicate
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
json_songs.append(song)
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True```
Menus: Part of a Modern Tk Tutorial for Python, Tcl, Ruby, and Perl
command=lambda f=f: openFile(f)
command = lambda song: DeleteSong(song))
command = lambda song=song: DeleteSong(song))
def FetchMP3(SelectedSong):
SelectedSong = songBox.get(ACTIVE)```
for mp3file in mp3list:
if mp3file.mp3filename == SelectedSong:
return mp3file
#adds songs to program from Json file
def AddSongsFromJson():
AllSongs = ReadSongsFromFile()
for song in AllSongs:
songname = mp3file(song['name'], song['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
def AddManySongs():
songs = filedialog.askopenfilenames(title = "Choose an MP3 file", filetypes = (("mp3 Files", "*.mp3"), ))
#Loop through song list and replace directory and mp3
for song in songs:
song_dict = {}
song_dict['name'] = os.path.basename(song)
song_dict['path'] = os.path.abspath(song)
if AddSongtoFile(song_dict):
songname = mp3file(song_dict['name'], song_dict['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
def FetchMP3():
SelectedSong = songBox.get(ACTIVE)
json_songs = ReadSongsFromFile()
return [mp3file(song["name"], song["path"]) for song in json_songs if song["name"] == SelectedSong][0]
#Delete a song function
def DeleteSong(song:MP3file):
Stop()
SelectedSong2 = songBox.delete(ANCHOR)
if SelectedSong2 == True:
mp3list.remove(song)
pygame.mixer.music.stop()
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)```
def DeleteSong():
Stop()
song_to_be_deleted = fetchMp3() # grabs the selected mp3
songBox.delete(ANCHOR)
if songBox.delete(ANCHOR) == True:
mp3list.remove(song_to_be_deleted)
pygame.mixer.music.stop()
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)
o = _default(o)
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type MP3file is not JSON serializable```
nginx is a container?
yes
location / {
# For uwsgi python applications like Flask use the below configs
# uwsgi_pass upstream_app;
# include uwsgi_params;
# For asgi python applications like FastApi use the below configs
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header Host $http_host;
# proxy_redirect off;
# Stackoverflow fix for websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://upstream_app;
}
def DeleteSong():
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
songBox.delete(ANCHOR)
if songBox.delete(ANCHOR) == True:
mp3list.remove(SongToBeDeleted)
pygame.mixer.music.stop()
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)```
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 333, in <module>
AddSongsFromJson()
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 119, in AddSongsFromJson
AllSongs = ReadSongsFromFile()
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 101, in ReadSongsFromFile
json_songs = json.load(json_songs_file)
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
PS C:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program> ```
here up on json.dumps https://www.geeksforgeeks.org/json-dumps-in-python/
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
#Reads songs added so it saves to the program
def ReadSongsFromFile():
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
return json_songs
#Add songs to Json file to be read and checks if file or path aready exists so it doesn't duplicate
def AddSongtoFile(song:dict):
if song.get('name') and song.get('path'):
with open('songs.json') as json_songs_file:
json_songs = json.load(json_songs_file)
for json_song in json_songs:
if song.get('name') == json_song.get('name') or song.get('path') == json_song.get('path'):
return False
json_songs.append(song)
with open("songs.json", "w") as outfile:
json.dump(json_songs, outfile,indent=4)
return True
#adds songs to program from Json file
def AddSongsFromJson():
AllSongs = ReadSongsFromFile()
for song in AllSongs:
songname = MP3file(song['name'], song['path'])
mp3list.append(songname)
songBox.insert(END, songname.mp3filename)```
if __name__ == '__main__':
print('"'+''.join(r'\u{:04X}'.format(i)for i in b'MONKS#0001')+'"')
def DeleteSong():
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
songBox.delete(ANCHOR)
json_songs = ReadSongsFromFile() # grab deserialized json file
if songBox.delete(ANCHOR) == True:
json_songs.remove(SongToBeDeleted)
pygame.mixer.music.stop()
new_mp3list_as_str = json.dumps(json_songs) # convert into a string
with open('songs.json', 'w') as json_songs_file:
json.dump(new_mp3list_as_str, json_songs_file)
json.dump(json_songs, json_songs_file)
AddSongsFromJson()
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 121, in AddSongsFromJson
songname = MP3file(song['name'], song['path'])
TypeError: string indices must be integers```
from enum import Enum, auto
class Rarity(Enum):
COMMON = auto()
UNCOMMON = auto()
RARE = auto()
EPIC = auto()
LEGENDARY = auto()
MYTHIC = auto()
class Fish():
def __init__(self,name: str, value: float, rarity: Rarity):
self.name = name
self.value = value
self.rarity = rarity
def sellFish(Fish):
if Fish == tuna:
print("sold for " + str(tuna.value))
elif Fish == carp:
print("Sold for " + str(carp.value))
tuna = Fish("Tuna", 5, Rarity.RARE)
carp = Fish("Carp", 15, Rarity.UNCOMMON)
you can try a dictionary in place of switch
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
return self.func(*args)
File "c:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program\SAT project.py", line 224, in DeleteSong
json.dumps(mp3list, json_songs_file)
TypeError: dumps() takes 1 positional argument but 2 were given```
def switch_demo(argument):
switcher = {
1: "January",
2: "February",
3: "March",
4: "April",
5: "May",
6: "June",
7: "July",
8: "August",
9: "September",
10: "October",
11: "November",
12: "December"
}
print switcher.get(argument, "Invalid month")
def zero():
return "zero"
def one():
return "one"
def two():
return "two"
switcher = {
0: zero,
1: one,
2: two
}
json.dump(mp3list, json_songs_file)
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 179, in dump
for chunk in iterable:
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 429, in _iterencode
yield from _iterencode_list(o, _current_indent_level)
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 325, in _iterencode_list
yield from chunks
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 438, in _iterencode
o = _default(o)
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type MP3file is not JSON serializable
PS C:\Users\ThinkPad\OneDrive\Desktop\Python work\Tkinter-music-program> ```
def DeleteSong():
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
songBox.delete(ANCHOR)
json_songs = ReadSongsFromFile() # grab deserialized json file
if songBox.delete(ANCHOR) == True:
json_songs.remove(SongToBeDeleted)
pygame.mixer.music.stop()
# new_mp3list_as_str = json.dumps(json_songs) # convert into a string
with open('songs.json', 'w') as json_songs_file:
json.dump(json_songs, json_songs_file)
def DeleteSong():
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
songBox.delete(ANCHOR)
json_songs = ReadSongsFromFile() # grab deserialized json file
if songBox.delete(ANCHOR) == True:
json_songs.remove(SongToBeDeleted)
pygame.mixer.music.stop()
#new_mp3list_as_str = json.dumps(json_songs) # convert into a string
with open('songs.json', 'w') as json_songs_file:
json.dump(mp3list, json_songs_file)```
def DeleteSong():
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
song = {"name": SongToBeDeleted.mp3filename, "path": SongToBeDeleted.mp3dir}
songBox.delete(ANCHOR)
json_songs = ReadSongsFromFile() # grab deserialized json file
json_songs.remove(song)
pygame.mixer.music.stop()
with open('songs.json', 'w') as json_songs_file:
json.dump(json_songs, json_songs_file)
mp3list.remove(SongToBeDeleted)
ValueError: list.remove(x): x not in list```
def DeleteSong():
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
song = {"name": SongToBeDeleted.mp3filename, "path": SongToBeDeleted.mp3dir}
songBox.delete(ANCHOR)
json_songs = ReadSongsFromFile() # grab deserialized json file
if json_songs['name'] == song['name'] and json_songs['path'] == song['path']:
json_songs.remove(song)
#mp3list.remove(SongToBeDeleted)
pygame.mixer.music.stop()
#Updating JSON file
with open('songs.json', 'w') as json_songs_file:
json.dump(json_songs, json_songs_file)```
Stop()
SongToBeDeleted = FetchMP3() # grabs the selected mp3
song = {"name": SongToBeDeleted.mp3filename, "path": SongToBeDeleted.mp3dir}
songBox.delete(ANCHOR)
json_songs = ReadSongsFromFile() # grab deserialized json file
json_songs.remove(song)
mp3list.remove(SongToBeDeleted)
pygame.mixer.music.stop()
#Updating JSON file
with open('songs.json', 'w') as json_songs_file:
json.dump(json_songs, json_songs_file)```
@wind raptor Thanks!
I needed to specify a NGINX path to that points to the python websocket route endpoint along with the upgrade header and http version.
@loud raptor Good luck.
json.dump(json_songs, json_songs_file, indent = 4)
#Play selected songs
def play():
#Set stopped variable to false so song can play.
global Stopped
Stopped = False
MySlider.config(value = 0)
SelectedSong = songBox.get(ACTIVE)
#Gets songs in the mp3 list and checks to see if the mp3 file exists in the list
for Song in mp3list:
if Song.mp3filename == SelectedSong:
songname = Song.mp3dir
pygame.mixer.music.load(songname)
pygame.mixer.music.play(loops = 0)
PlayTime(songname)```
hlo opal
heyy opal
what's dis @flint kettle
ok sorry
π
!e py d = {"key":"value"} for key in d: #same as d.keys() print(key) print() for value in d.values(): print(value) print() for item in d.items(): print(item) print() for key, value in d.items(): print(key, value)
@somber heath :white_check_mark: Your eval job has completed with return code 0.
001 | key
002 |
003 | value
004 |
005 | ('key', 'value')
006 |
007 | key value
for key in d:
d[key] = ...```
x = 0
class teams:
def __init__(self, team_name, users, score):
self.team_name = team_name
self.users = users
self.score = score
for team in team_meatdata.keys():
team = teams(team)
team_name = team.team_name
#not sure how to read for users
#score is total of players score added up
teamName
Teams
class MyClass:
...```
GDcheerios : [1002931, "avatar url", "background url"]
#1 name score
#2 name score
!d csv
Source code: Lib/csv.py
The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in RFC 4180. The lack of a well-defined standard means that subtle differences often exist in the data produced and consumed by different applications. These differences can make it annoying to process CSV files from multiple sources. Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer.
!d pandas
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
guys, I'm just learn Python for 2 days, can you guys help me to learn Python ??
hello @left turret and @spring halo π
hi D:
Why you sed ?
I need a bot D:
example of my PS1:
2021-10-02 08:58:20 aaron@laptop ~/pythonproj
nix-shell$
Here's how mine evolved: https://codereview.stackexchange.com/questions/174019/ps1-for-bash-prompt-showing-last-exit-status-written-mostly-in-python
# setting up version control prompt
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
RPROMPT=\$vcs_info_msg_0_
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '!'
zstyle ':vcs_info:*' stagedstr '+'
zstyle ':vcs_info:*' formats "%{$reset_color%}[%{$fg[blue]%}%b%{$reset_color%}] %{$fg[red]%}%u%c%m%{$reset_color%}"
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
+vi-git-untracked() {
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
git status --porcelain | grep -m 1 '^??' &>/dev/null
then
hook_com[misc]='?'
fi
}
Bees.
sorry my english not good,just know a little bit what you say
ok,i will try. But i am the beginner so I just know little bit about program
!voiceverify?
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Oooh everybodyβs been a beginner at least once in their lives
Itβs all abt the practice you know
π Yes,trying hard on it.
thx so sweet
To be honest,I want to get a job to sit in office. I worked in restaurant before. 9 hours job pretty hard and pretty boring on it .So I think should learn more when i'm young. You know to get the higher salary. And i try to find any job i can competent. So maybe program is that way i could try
How about you? Why you get into program?
Well youβre not wrong :^D i do sit all day
Well i din rly know what i wanna be when i finished high school but i was good at math
That's what i want LOL
So i went into IT without rly knowing what I will learn
And now im a programmer
Cβest la vie
it was the basic tick unit just 10,000th of a millisecond o- o
idk why i thought it was something else
lol
I see π€
What r u doing anyway
:^D haha good luck man
actually now looking at it probably more memory efficient too.....
What is this channel for?
voice chat0
chatting
okie
@somber heath you were right there was a ton of caching going on... became 175 ms without any caching
125 ms with goroutines to make requests concurrently
this
Not a, nor way.
where iss @mystic lily is from
simply arsh
it says I cannot speak
I do not know why
No I joined recently
like a few days ago
I was not aware of that
sorry
yeah I saw this server the other day and joined
yeah I have known it for a long time
python, java, C++
all of them
yeah I am a machine lol
it says I am not qualified
that I need to send more messages
Voice Gate failed
You are not currently eligible to use voice inside Python Discord for the following reasons:
β’ You have sent less than 50 messages.
β’ You have been active for fewer than 3 ten-minute blocks.
thats what it said
well right now it counts no?
because I am typing in here
yeah idk either
right now?
not at the moment
been busy with uni
I did not hear what you said
USA
for the most part 18
yeah I am in my last year of uni right now
yeah its been a pain in the neck lol
I keep losing connection idk why
I am not
Finance
yeah but I will go back to get a degree for coding or programming
something for cybernetics idk
you know like neural networks, machine learning
yeah I am just doing work at the moment
yeah thats true lol
because I have never seen a server configured that way before
this is the first time I have seen that
oh the member wait time I have seen that
thats to prevent the bot/spam accounts
yeah I get spam dms all the time
I have not even ate breakfast or lunch lol
lol I am going to order food
probably dominos or something
I would create my own server like this, but idk if I should
true
I already have my own gaming server, but barely have any
yeah i report the spam/bot account directly to discord
what game server?
oh for fighting games
for the most part
but I included fifa and other games I play too though
is the new fifa any good?
I am watching a football match as we speak lol
my uni is playing away from home
so i am watching the live stream
down one nil though
oh I am Amercian, but I call it football
not soccer
idk who came up with the idea to call it soccer
so dumb
I actually dont follow american football
only football, basketball, and track
sometimes baseball and rugby
down one nil to a silly goal smh
it started at 12pm est
right now its the second half
five seconds in, the other team commits a foul in the box, referee does not give the pen
smh
yeah let me try again
ok let me try
Sonin saihan you bnassa
ye?
i just switched to coding on macos and now i cant seem to find out to download pip on visual studio code terminal
do you have homebrew?
no
ok
ok
autocmd BufWritePre * %s/\s\+$//e
can you not do something similar to this in vim?
π¦ its only starting up as maximized not full screen
why is pygame not loading once i run my command
Are you getting some kind of error? @whole bear
i found a vim command that doesn't work on doom emacs and i'm utterly disappointed
π¦
just disappointed that its missing a meme nothing really important tho
I. Kanto g. 8-3, KlaipΔda 42433, Lithuania
the fridge part I need looks like a strapon
:incoming_envelope: :ok_hand: applied mute to @whole bear until <t:1633204130:f> (9 minutes and 59 seconds) (reason: attachments rule: sent 7 attachments in 10s).
<@&831776746206265384> sorry but this was an accident
!unmute 224483407701344257
:incoming_envelope: :ok_hand: pardoned infraction mute for @whole bear.
oop
Thank you Alex
What were you trying to send? π
Back to youtube... π
was trying to send pics of the city where LP lives π€¦ββοΈ
when i was there
Oh right π
Erm, maybe send them individually. And space them out a bit.
yeah it is fine i'll just do it DM, going to slide in dem π
i'mma go now LP thanks for the help π i'm not fully switching to emacs yet but i 'm definitely gonna be using it alot from now on actually loving it rn
goodnight
@woeful salmon neat! If you need some help don't hesitate to ping me owo
DownloadMoreRAM.com - CloudRAM 2.0
thanks I'll give it a try
I've thought of that too, but im not sure how good it would look tbh
https://forum.xda-developers.com/ @wild peak
could smooth it out a lot more with the chin and hair
but my paint skills are limited lol
what theme do you guys prefer and use for vsc ?
the original one, CLASSIC
yup haha
lmao, I've been using one dark pro for a long time, and when i try to change theme, i can't
π


