#๐Ÿ”’ Discord bot help

38 messages ยท Page 1 of 1 (latest)

proud holly
#

help pls

icy briarBOT
#

@proud holly

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

silk cradle
#

code and traceback

#

!traceback

icy briarBOT
#
Traceback

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

silk cradle
#

!paste

icy briarBOT
#
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

proud holly
#

Error:
from network import authority_matrix
ImportError: cannot import name 'authority_matrix' from 'network' (C:\Users\kiril\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\network.py)

How do I upload authority_matrix to the nerworkX library? I searched the internet, no solution helped.

silk cradle
#

nerworkX or networkX

#

also I mean your code, not the module code

proud holly
#

I accidentally made a mistake.

silk cradle
#

but I don't know which is actually correct lmao

#

just copy the one that is correct

#

and paste it

#

!pypi networkX

icy briarBOT
#

Python package for creating and manipulating graphs and networks

Released on <t:1698482499:D>.

silk cradle
proud holly
# icy briar

I wrote pip install networkx, says it's already downloaded. The error is that I don't have authority_matrix in the networkx library, so I'm asking how to add it to the library.

silk cradle
#

ok, thx

#

can you give me your code

#

the one that importing the file

proud holly
#

The code that imports the file? Could you explain a little more clearly?)

silk cradle
#

I need some confirmation of stuff, since I identified 2 issue:

  1. Module: networkx should be import using name networkx as stated in the example in README:
>>> import networkx as nx
>>> G = nx.Graph()
>>> G.add_edge("A", "B", weight=4)
>>> G.add_edge("B", "D", weight=2)
>>> G.add_edge("A", "C", weight=3)
>>> G.add_edge("C", "D", weight=4)
>>> nx.shortest_path(G, "A", "D", weight="weight")
['A', 'B', 'D']
  1. authority_matrix from networkx have been deperceded at version 2.6
[#4617] Deprecate hub_matrix and authority_matrix

and removed in version 3.0

Remove deprecated functions hub_matrix and authority_matrix (#5767)
proud holly
#

My error is not given by networkx, but by authority_matrix, because it is not in the network library. And the error appears when I want to launch the bot.

silk cradle
#

yeah, because it no longer exist now + you import the wrong thing either way

proud holly
#

If sometimes it's not clear what I'm writing, then I'm sorry, the translator translates that way)

silk cradle
#

Downgrading networkx

proud holly
#

And how do I fix this error?

silk cradle
#
pip unistall networkx
pip install networkx~=2.5.0
#

and also fix your code

#

you are importing network, not networkx

proud holly
#

I did everything, but the result is still the same.

icy briarBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.