Modify global variable from async function in python I'm making a Discord bot in Python using discord.py. I'd like to set/modify a global variable from an async thread.  message = ""  @bot.command() async def test(ctx, msg):     message = msg   However this doesn't work. How can I achieve something that does this?
Using global variables in a function How can I create or use a global variable in a function?  If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in a local variable of the function which needs its access?
I'm starting a very long quest to learn about math, so that I can program games. I'm mostly a corporate developer, and it's somewhat boring and non exciting. When I began my career, I chose it because I wanted to create games.  I'm told that Linear Algebra is the best place to start. Where should I go? How do I figure out what package something is in without resorting to Google? I often find myself wanting to install something, but I'm unsure of what package it's in. This is a very common occurrence for me:  $ make html sphinx-build -b djangohtml -d _build/doctrees   . _build/html make: sphinx-build: Command not found make: *** [html] Error 127  $ sudo apt-get install sphinx E: Unable to locate package sphinx  $ sudo apt-get install sphinx-build E: Unable to locate package sphinx-build   googles  $ sudo apt-get install python-sphinx   Is there a better way? Repeating an equation including its content and number On found exact duplicates, should these be voted to close directly against a preferred, or ultimate, canonical question?   Or is a chain of possible duplicates (where one question is closed as duplicate of another, which itself is a duplicate of another, and so on and so on) allowable or OK?  One example of this situation can be found . ASP.NET MVC Relative Paths In my applications, I often have to use relative paths. For example, when I reference JQuery, I usually do so like this:  &lt;script type="text/javascript" src="../Scripts/jquery-1.2.6.js"&gt;&lt;/script&gt;   Now that I'm making the transition to MVC, I need to account for the different paths a page might have, relative to the root. This was of course an issue with URL rewriting in the past, but I managed to work around it by using consistent paths.  I'm aware that the standard solution is to use absolute paths such as:  &lt;script type="text/javascript" src="/Scripts/jquery-1.2.6.js"&gt;&lt;/script&gt;   but this will not work for me as during the development cycle, I have to deploy to a test machine on which the app will run in a virtual directory. Root relative paths don't work when the root changes. Also, for maintenance reasons, I cannot simply change out all the paths for the duration of deploying the test - that would be a nightmare in itself.  So what's the best solution?  Edit:  Since this question is still receiving views and answers, I thought it might be prudent to update it to note that as of Razor V2, support for root-relative urls is baked in, so you can use   &lt;img src="~/Content/MyImage.jpg"&gt;   without any server-side syntax, and the view engine automatically replaces ~/ with whatever the current site root is. Why does $a^n - b^n$ never divide $a^n + b^n$? How to make Ethernet work on Android over OTG? Let's say I have Table A: BookingsPerPerson  Person_Id    ArrivalDate    DepartureDate 123456       2012-01-01     2012-01-04 213415       2012-01-02     2012-01-07   What I need to achieve with a view is the following:  Person_Id    ArrivalDate    DepartureDate    Jan-01    Jan-02    Jan-03    Jan-04    Jan-05    Jan-06    Jan-07 123456       2012-01-01     2012-01-04       1         1         1         1 213415       2012-01-02     2012-01-07                 1         1         1         1         1         1   The system is for events, so each hotel booking could take anything between 1 to 15 days but no more than that. Any ideas would be very much appreciated. Freeze first column in SharePoint List View? I am working in SP2013 , in a particular list view  we want to freeze first column on horizontal scrolling.  Please help on this if any one having idea/code/any reference URLS. Block cipher fixed points (plaintext equal to ciphertext) Mark questions to receive notifications and updates? I want to install Ubuntu on the C: partition where my Windows 7 is, simply to replace the systems. I've also tried to install it on another partition (without formating it), which failed!  All I get is:      No root file system is defined. Please correct this from the partitioning menu.   I want to install Ubuntu without formatting any of my partitions. Is that possible? Possible Duplicate:          I received two answers to a question I asked. One solution suggested I do things in a completely different manner than I have been. Another acknowledged that the first solution was correct but went on to explain how to do what I was asking.  Should I accept the first answer because it provides the better way of doing things or should I accept the second one because it answers the precise question that was asked? Why do some tests have a (nonzero) minimum score? Can wizards really cast spells in armor? How do I show that $x^4-10x^2+1$ is irreducible over $\mathbb{Q}$? Someone says I should use the rational root test, but I don't exactly know how that applies. Thanks for any input. Parsing JSON with Unix tools What is the meaning of this "let there be light" joke? Book identification: technologically-enhanced man (1970s/80s YA) FaceTime not working on iPhone 6 Plus purchased from Dubai I bought my iPhone 6 Plus in Dubai. I am using the phone in Sri Lanka and I cannot use the FaceTime. How can I use FaceTime while in Sri Lanka?