Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in other languages. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive set of standard libraries, including NumPy, SciPy, Django, PyQuery, and PyLibrary.

Share tech news, updates, or what's on your mind.

Sign up to Post

I'm curious..

I have made a few network game projects w help of sporadic legends on this site.

Now, a Python network game.

It seems Pygame can do adequate 2D gaming, side scroller / maze etc
How about a networking game client?
It looks like all the usual abilities are available.
I might make my server in Java, but my game clients in Python?

A plan?
Expert Spotlight: Joe Anderson (DatabaseMX)
LVL 13
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

i spent 6 hours yesterday trying to figure out sorting in python.

i get that:
for k in sorted(djTime.items(), key=lambda x(-x[1], x[0])):
should take every instance of k in djTime and perform something on something else.
i've understood the same of
for line in sorted(djTime):
should take a logfile previously broken into lines by the rstrip('\n') method and see the items as lines
i understand *line* or *k* in any circumstance can be any variable (i.e.) for JohnDoe in sorted(djTime):

i don't understand how or what python is looking for to differentiate between items either in a list or in a dictionary

i believe if you say:
for k, v in sorted(djTime.items())
...and this is a tuple, the k is representative of the key, and the v is representative of the value? but i'm not really clear

do you have to specify 2 variables/objects to sort a tuple? is a single non nested dictionary always a tuple? (i.e. for k, v in sorted(djTime)
do you have to use .items? what if i want to sort by key? can i sort like this:  for k, v in sorted(djItems.keys())  can i do it by values? : for k, v in sorted(djItems.values()

as for the remainder of the command up there :     x(-x[1], x[0])
i have no idea what the first x is, but the second seems to me to denote the position in the tuple? where counting begins with 0 so x[1] is the second item and x[0] is the first item? kinda backwards?? and the - negative in front of the main -x[1] mean sort from bottom to top

what i'm …
I am trying to use MatLibPlot to plot the x,y cordinates .... using opencv I have collected x,y coordinates of an object ... saved the coordinates in a sqlite db ... Connected to the db abd retrieved the coordinates ... I have placed a sample of my code below showing how I retrieved the coordinate ... I also tried retieving just the x -coor the retrieve the y- coordinates...
 coordinat_y [('289', '98'), ('304', '105'), ('289', '174'), ('921', '111'), ('786', '116'), ('772', '129'), ('740', '139'), ('633', '148'), ('469', '311'), ('466', '304'), ('443', '137'), ('439', '200'), ('444', '339'), ('433', '225'), ('429', '185'), ('424', '166'), ('423', '191'), ('424', '281'), ('421', '329'), ('409', '250'), ('397', '218'), ('388', '245'), ('383', '348'), ('366', '323'), ('347', '275'), ('325', '321'), ('304', '389'), ('269', '330'), ('237', '357'), ('190', '444'), ('162', '400'), ('77', '490'), ('4', '486'), ('326', '267'), ('271', '107'), ('114', '130'), ('85', '232'), ('46', '328'), ('573', '96'), ('573', '282'), ('559', '148'), ('460', '132'), ('461', '301'), ('442', '218'), ('429', '155'), ('396', '184'), ('392', '269'), ('381', '288'), ('177', '111'), ('167', '208'), ('102', '192'), ('518', '106'), ('563', '256'), ('779', '94'), ('846', '360'), ('875', '169'), ('349', '119'), ('363', '291'), ('361', '234'), ('393', '107'), ('415', '327'), ('418', '182'), ('513', '99'), ('582', '362'), ('613', '146'), ('365', '231'), ('342', '157'), ('269', '95'), ('268', '281'), ('256',

Open in new window

I have tried to install Django and I have written the following command in Power Shell:

PS C:\project\firstproject> virtualenv venv-first-project

but the below error is raised :

virtualenv : The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ virtualenv venv-first-project
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (virtualenv:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

how can I solve this error?
Hello, I am an experienced developer with scripting and object oriented languages. I am looking for a good book on Python 3. Can someone recommend a good book?
Hi Experts,

I get the following error for python application.

django.db.utils.OperationalError: FATAL:  remaining connection slots are reserved for non-replication superuser connections

Open in new window

I use for configuring database.   I am using Postgres as a database

I had set connection_max_age to 0 in the config.

Still, I get this error.

I had checked the entire source code by using grep there is no connection in the source code.

I getting this error from inside docker container.  the database is outside the docker container.

the connection string I use to connect is DATABASE=postgres://test:*****@ where is docker gateway.

max_connection =100 in postgresql.conf which located inside /etc/postgresql/9.5/main/

Any help is greatly appreciated.
Hello. I would like to track/rotoscope/cover the movements of a bunch of human figures who are inside a series of pictures (or inside a video) with 3D characters (created and RIGGED in Blender). They should behave at the same way of the human figures ; it means that they should make the same movements. I think that I should track also the camera. Can u tell me if this kind of job is doable with these script :

or which kind of tool and approach do you want to use ?

I have also tried to run the demo of OpenPose with this command line :

C:\Users\virtu\OneDrive\Desktop\RotoRIG\TOOLS\openpose-1.4.0-win64-cpu-binaries>bin\OpenPoseDemo.exe --video examples\media\video.avi --face --hand
Starting OpenPose demo...
Starting thread(s)...

it hangs but nothing happens.

Someone never heard about FlowBox or some other tool like this. Please read here :

He says :

Rotoscope Tracking, Painting, and Rigging

BLowBox also is working on RotoTRACK. RotoGLUE offers a planar tracking and point tracking system within the application. You can even use tracking data from other software through import.

RotoPAINT lets you paint over a sequence with built-in vector point tools, recording strokes as you go. Because paint strokes are vector, …
I've posted this in almost all major sites now and no-one has responded. Hopefully someone here can assist.

I'm getting a max of around 20Mbps on any file upload to Google Drive via the Python API which is resumable=True and chunked (regardless of chunksize), however I get my full internet speed of around 180Mbps upload on the same file when not using this method. The problem is that if the file is too big to fit in memory (or even threading many uploads) the computer will run out of memory and I will have to use chunked upload which is just too slow.

Am I doing something wrong? How can I upload a large file without having to worry about running out of memory and not be limited to 20Mbps?

Shared code between both examples:
import os
from google.oauth2 import service_account
from googleapiclient.discovery import build, MediaFileUpload

def create_drive_service(user_email,SERVICE_ACCOUNT_JSON_FILE,SCOPES=None):
    if SCOPES is None: SCOPES = ['']
    credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_JSON_FILE)
    credentials = credentials.with_scopes(SCOPES)
    credentials = credentials.with_subject(user_email)
    return build('drive', 'v3', credentials=credentials)
# Fill in the following
jsonpath = 'c:\\path\\to\\service_account.json'
service = create_drive_service('user@domain',jsonpath)
filename = 'filename.ext'
filepath = 'c:\\path\\to\\folder\\' + filename
parent_id = ''

Open in new window

Code that is slow:
file_metadata = {"name":filename,"parents":[parent_id]}
media = MediaFileUpload(filepath,chunksize=-1,resumable=True)
request = service.files().create(body=file_metadata,media_body=media,fields='id')
while response is None:
    status, response = request.next_chunk()
file = request.execute()

Open in new window

Code that works full-speed but not if the file is too big to fit in memory:
file_metadata = {"name":filename,"parents":[parent_id]}
media = MediaFileUpload(filepath,resumable=False)
request = service.files().create(body=file_metadata,media_body=media,fields='id').execute()

Open in new window

How can I upload a large file without having to worry about running out of memory and not be limited to 20Mbps?
Hi , i am a storage admin, and i would like to automate the health  check and  performance ( IOPS and latency )  of the Netapp and IBM storage using Python script, currently i have started to learn python, i would like to have expert advice on the python script  to login to the storage and collecting the information and send as an email.

I am very beginner for scripting, it wold be relay grateful if  experts guiding on this
I have an interesting issue with Python Copying GeoData into a Shared drive on a unity400 SAN


This Errros with Failed to execute (FeaturClassToFeatureClass) with Error 000210.

now the interesting part..  When running Process Monitor - This works fine - What could Process Monitor be doing?

I thought it may be creating a delay, between creating the Geo Data folder structure, and filling it,  so I have added a delay in the script.  
The only thing I can think of is it is either forcing something to close, or keeping something open, but I'm not sure how to check?  any ideas?
OWASP Proactive Controls
LVL 13
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Hello Experts,

Can someone take a look at the following Python code and let me know why I'm getting the error:

TypeError: 'int' object is not iterable

list_sum = 0

for num in list_sum:
  list_sum = list_sum + sum

Open in new window

The full error message is as follows:

TypeError                                 Traceback (most recent call last)
<command-1972516025746490> in <module>()
      1 list_sum = 0
----> 3 for num in list_sum:
      4   list_sum = list_sum + sum

TypeError: 'int' object is not iterable

Open in new window

Hello Experts,

This questions requires someone with experience with Python and Databricks

A member from another forum assisted me in copying files to a follow based on date,

I would like to tweak the code to copy file based on certain characters in a filename – in the example that follows the characters are 1111, 1112, 1113 and 1114
So, if we have four files as follows:


I would like File_Account_1114_sam34.csv copied to the folder only if File_Account_1113_pringle.csv has already been copied to the folder.
Likewise I would only want File_Account_1113_pringle.csv copied  if File_Account_1112_testxx.csv has been already been copied to the folder and so on.

Therefore, if all files have been copied to a folder it would look like the following:

dbutils.fs.put("/mnt/adls2/demo/files/file_Account_1111_exam1.csv", data, True)
dbutils.fs.put("/mnt/adls2/demo/files/file_Account_1112_testxx.csv", data, True)
dbutils.fs.put("/mnt/adls2/demo/files/file_Account_1113_pringle.csv", data, True)
dbutils.fs.put("/mnt/adls2/demo/files/file_Account_1114_sam34.csv", data, True)

I appreciate there aren't many Experts with experience with Databricks on EE, however any help will be greatly appreciated.

I was trying to setup Unetlab / Eve-Ng simulator for networking. I have installed and configured Eve however I’m stuck at adding images. I am getting error while trying to create iourc license with python script. Any help pls
I need to install Python 3 and PIP on a Redhat 7 Server in an environment with no direct Internet access, can you advise the best way to do this?
Hello Experts,

Can someone advise on applications that will generate Flow charts from Python code.

I looking for a tool is intelligent enough to convert code into logical flow.


I am want to ask some devops questions.
Where in Devops we us Python scripts.
I have a secondary question for Excel in the que trying to show in Real Time the elapsed time displayed after a time stamp is generated by the selection of a cell.

I am hoping to create a listing solution that shows something like this.

Priority Code           Question #      Time In        Item Code       Description         Special Instructions         Elapsed Time         Student    Table #      Time Out
ER                         11                    12:00:00       400               Math Q11      Student has LRN DIS     00:12:43                 Rob             3                  NA      If complete Time =12:12:43

1                            11                    12:02:23       400               Math Q11     Student Hear Impair     00:09:16                  Mary           5                  NA

2                            9                      12:01:47       398               Math Q9        Student Vis Impair        00:08:57                  Erica            4                  NA

If the Priority code entered is ER the row moves to the top of the list or if the Elapsed time is the highest priority It moves to the top of the list. So the point is if the value is manually changed in the Priority Code as ER it moves to the top row automatically. The Elapsed time is listed in descending order. This keeps instructors on top of who is struggling with whatever question is stopping most students or who has been given priority regardless of the elapsed time. Some students need priority help …
Content of my canvas looks like it is not in the canvas tkinter.
Here is the code:
from tkinter import *
root = Tk()
height = root.winfo_screenheight()
canvas = Canvas(root, bd=0,width=800,height=height,bg = "blue")
screen_fit = height/105
frame_number = 2
EDIT_QUESTIONS= Label(root,text="Edit questions",font = "Courier").grid(row = 1,column = 1)
class edit:
    def __init__(self):
    def new_frame(self):
        def remove(window):
        def new_frame1(self):
            global frame_number
            frame = Frame(root)
            r = (10 + 105)* (frame_number -1)
            frame_number =  frame_number + 1
            window = canvas.create_window(25, r , anchor = "nw", window = frame,tags =(frame_number))
            text = Text(frame,height = 2)
            plus = Button(frame,text="+",command = self.new_frame)
            minus = Button(frame,text="-" )
            #minus.config(command = lambda: remove(window))

            if frame_number > int(screen_fit)or frame_number == int(screen_fit):
                def on_mousewheel(event):
                    canvas.yview_scroll(-1*(int(, "units") 

                scrollbar= Scrollbar(root,orient="vertical",command=canvas.yview)
                scrollbar.grid(row=2,column=4,sticky =

Open in new window

Have DRF View based on APIView , from which I'm getting queryset as a list of tuples.
I need to serialize this queryset and pass it to rest_framework.response.Response object as a result, i.e.
How should Serializer class look to accomplish this task?

class SomeView(APIView):

    def post:
        result = cursor.fetchall()
        serializer = SomeSerializer(result)
        return Response(

Open in new window

How should I render result in SomeSerializer class? Can you give me working implementation of that?

P.S. Thera are no any model related to these results in the system.
Rowby Goren Makes an Impact on Screen and Online
LVL 13
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

I am designing the game Othello or Reversegram as it is known in some places. I'm almost done coding the game save for tallying up the final score and tweaking the AI to make more intelligent moves (currently only doing random moves). However, I am encountering certain bugs that appear. While the CPU and I keep flipping the pieces, there will come some point where I either cannot make a move even though it is certainly legal to do so. As well as the fact that when I play certain moves usually around the edges, it sometimes won't flip the opposing pieces even though I just made a legal move. If I can get some help understanding where I should be making my edits--I think the error might be in the "findLegal" function. Thank you for your help!

Note: I recreated the board with W on 6b, and B on 7b and 8a and could make the legal move of W on 8b so vertical moves are generally accepted and work up until a certain point which I'm confused about. In addition, I originally set up the board in the picture with random pieces throughout to accelerate the game and also to test out the various issues I had (so please ignore the random W on 4h).
Is it possible in Java to connect to the websocket?
Here is Python 2.7 / Twisted

It is hard to understand what exactly should be sent to to make it upgrade to WebSocket.
I am trying to find a way to query the configuration of an Azure load Balancer using an API and either powershell or python script to populate two fields in the API, the ResourceGroup name and the Subscription ID. The output will need to be in a JSON or XML format.
I have a Tkinter application (python 2.7) that copies , configures , remove files. During this operation, I would like to pop up a please wait message box without any buttons while the process is running to inform the users What is the best way to do this.
Thank you for your Quick Prompts.
Dear Experts

I have a question about python and mysql interaction. I have big table which contains column named DATETEXT, which simply contains full datetime in text format, like "Fri, 09 Aug 2013 18:46:10 +0200", I need to convert it to datetime value which is not a problem, but I need to update another column in the same table with this value.

So my question is how to update one columns in table X based on value of another column in table X.

Many thanks


error when running python script to remove VM from the output JSON file. Thanks

# nano
# python
/usr/lib/python2.7/site-packages/urllib3/ InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See:
Traceback (most recent call last):
  File "", line 29, in <module>
    res = delete_vm(vm_id, access_token)
NameError: name 'vm_id' is not defined

delete python script

from fusion import delete_volume
from fusion import delete_vm
from fusion import get_token
import json
import os
from time import sleep
from os.path import isfile, join

mypath = 'outputs'
time_delay = 20

## get all files inside hte outputs directory
onlyfiles = [f for f in os.listdir(mypath) if (isfile(join(mypath, f)) and (f.find('.json') > 0) )]

if len(onlyfiles) > 0:
    access_token = get_token()

for f in onlyfiles:
    vm_file_path = "outputs/" + f

    with open(vm_file_path) as vm_file:
        vm_data = json.load(vm_file)
        for vm in vm_data:
            volume_id = vm['volume_id']

            ## TODO: Check for the existence of the
            ## VM and volume and move forward

            res = delete_vm(vm_id, access_token)
            if res:
                print("Deleted {0} VM successfully.".format(vm['name']))



Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in other languages. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive set of standard libraries, including NumPy, SciPy, Django, PyQuery, and PyLibrary.