Çözüldü Python "unexpected indent" hatası

Bu konu çözüldü olarak işaretlenmiştir. Çözülmediğini düşünüyorsanız konuyu rapor edebilirsiniz.

Tolga Berat

Hectopat
Katılım
5 Ocak 2020
Mesajlar
190
Yer
Ankara, Türkiye
Daha fazla  
Sistem Özellikleri
Windows 10 Pro
Asus P8H61 -M PRO
NVIDIA Geforce GTX 760 EVGA 2GB SC
Intel Core i5-3350P
1TB HDD
240GB SATA SSD
Asus MX239H
Cinsiyet
Erkek
[CODE lang="python" title="Konsol hatası"]Traceback (most recent call last):
File "main.py", line 3, in <module>
import music.
File "/home/runner/Music-Bot/music.py", line 10.
async def join(self,ctx):
^
IndentationError: unexpected indent[/CODE]

Replit adlı bir websitede Python programlıyordum. Sonra bu hata ile karşılaştım. Hatanın sorunu nedir?
 

Dosya Ekleri

  • Ekran Görüntüsü (70).png
    94,5 KB · Görüntüleme: 357
Son düzenleyen: Moderatör:
Çözüm

Aman aman, nerelere geldik.


With kısmından emin değilim, 6 7 aydır discord.py kullanmadım. Onun haricinde boşluklar böyle olmalı.

Python:
import discord
from discord.ext import commands
import youtube_dl

class music(commands.Cog):
    def __init__(self, client):
        self.client = client
    @commands.command()
    async def join(self,ctx):
        if ctx.author.voice is None:
            await ctx.send("Bu kanala daha katılmadın aga.")
        voice_channel = ctx.author.voice.channel
        if ctx.voice_client is None:
            await voice_channel.connect()
        else:
            await ctx.voice_client.move_to(voice_channel)
    @commands.command()
    async def disconnect(self,ctx):
        await ctx.voice_client.disconnect()
    @commands.command()
    async def play(self,ctx,url):
        ctx.voice_client.stop()
        FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
        YDL_OPTIONS = {'format':"bestaudio"}
        vc = ctx.voice_client
        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
            url2 = info['formats'][0]['url']
            source = await discord.FFmpegOpusAudio.from_probe(url2,**FFMPEG_OPTIONS)
            vc.play(source)
    @commands.command()
    async def pause(self,ctx):
        await ctx.voice_client.pause()
        await ctx.send("Durduruldu ⏸️")
    @commands.command()
    async def resume(self,ctx):
        await ctx.voice_client.resume()
        await ctx.send("Devam ediyor ▶️")

def setup(client):
    client.add_cog(music(client))
Hocam tokeniniz gözüküyor düzenleyin mesajı.
Gerçi büyük ihtimalle discord tokeninizi paylaştığınızı görüp token değişikliği isteyecek ama düzenleyin yine de.
Hocam mesajı silebilirmisiniz? Sizdede gözüküyor.
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…