My summer project is also to learn Python. As such I've been busy converting all of my vbScript maintenance scripts. Feel free to post any Python questions and we'll try to help. I have found a few things frustrating but I've managed to work through most of them. I am currently wrestling with wxPython.

The short answer is to learn C++. You'll likely get a longer answer if you put more effort into doing it yourself first. In the mean time, read the Daniweb Posting Rules and Suggestions For Posting Questions.

You have four lists. One is the master list and the others are specialty lists. There is no guarantee that a person will be added to anything but the master list, and may be added to only one of the specialty lists. However, when you do a create_assignment, you remove the person from every specialty list. I suggest you either test to see if the person is in a list before doing the remove, or put each remove into a try/except block. Probably more concise if you just do the test.

if micleft_assign in mic_list:

This is your third post asking us to do all the work for you. Please read the Daniweb Posting Rules and Suggestions For Posting Questions before posting again.

Howie Mandel in his early stand-up comedy days.

  1. OK. Now we're going to do some improv.
  2. Give me an occupation.
  3. Give me a place.
  4. Give me a location.
  5. Now give me some funy things to say.

If you want help with something specific then post a specific question. Don't ask us to do all the work for you.

I have been wrestling with this for two days now and getting nowhere. Something is broken, either the GridSizer control or me. I'm hoping it's me and someone can show me the problem. I've stripped my app of non-essentials. What I am building is a Sudoku app which consists of several nested controls, as can be seen in the atached image. The outer frame contains the puzzle which contains a 3x3 grid of panes. Each pane contains a 3x3 grid of tiles and each tile contains a 3x3 grid of digits.

So far so good. Except for the layout. I use RPAD and CPAD to determine on which edge of a control to apply a border. As you can see in the image, for some unknown reason the layout logic insists on adding the PANEBORDER between the 2nd and 3rd columns, and the 2nd and 3rd rows. Similarly, it screws up the TILEBORDER in the tile placements.

I've included wx.lib.inspection.InspectionTool().Show() so that you can see (if you try this locally) that the border values wx.TOP, etc. are assigned correctly, just not laid out correctly.

Is there anyone out there proficient enough in wxPython to offer a suggestion?

import wx
import wx.lib.mixins.inspection

RPAD = (wx.TOP , 0, wx.BOTTOM)
CPAD = (wx.LEFT, 0, wx.RIGHT)

TILEBORDER =  5      

class App(wx.App):

    def OnInit(self):
        self.frame = Frame()
        self.frame.Position = (10,10)
        return True

class Frame(wx.Frame):

    def __init__(self):

        wx.Frame.__init__(self, None, title="Sudoku", style=wx.CLOSE_BOX | wx.CAPTION)

        self.puzzle = Puzzle(self)

        bsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.SetSizerAndFit(bsizer) ...

It's been out for several weeks. If you want to know what is new then google "what's new in windows 10 2019 update". Aside from a minor VPN problem there is nothing that should stop you from updating.

That's pretty low level stuff that you should be able to handle just by rereading your class notes. If you don't know how to flowchart a simple if-then structure then you've probably been sleeping in class.

What, specifically, is giving you problems?

"Driver Hell" is real

To be fair, it's much easier for Apple to minimize driver problems when they have complete control over the hardware. Microsoft can only provide the interface, then hope that the hardware manufacturers follow the rules when it comes to writing the drivers. Of course, that also depends on Microsoft providing proper (complete) documentation, and we know their record on that score.

I posted code that will do that. It's the only solution you have so far so use it until something better comes along. I tested it with the xml text that you provided, and requesting the fields you specified. I loaded the test data with

txtXML.Text = My.Computer.FileSystem.ReadAllText("D:\test.xml")




cheikh06 commented: thank you very much it works well with your function +0

Dang. I always complain when other people do this and now I did it. I left out the import when I posted the code. Please add the following:

Imports System.Text.RegularExpressions

I'll see if I can figure out the Linq version. I'll post it later if I have any luck.

cheikh06 commented: Thank you for your help with this function but it returns me not found +0

I've never had much luck working with XML and I'm sure there is a better way to do this via Linq but you could try a regular expression approace as in

Private Function GetField(name As String) As String

    Dim pattern = name & "=""(.*?)"""
    Dim rex = New Regex(pattern)
    Dim match = rex.Matches(txtXML.Text)

        Return match(0).Groups(1).Value
    Catch ex As Exception
        Return "not found"
    End Try

End Function

Pass it a field name like "supercollection name" (case sensitive) and it will return a field value as a string. If you want someone to post a Linq solution you'll have to post a complete xml sample document.

rproffitt commented: This is my story. Client hands me XML, Microsoft XMLreader blows up. I parse it with my own code. +15

For future reference, Code Snippet is meant for posting working and documented snippets of code. It is not to be used when you are posting a piece of code that you are having problems with. Please post under Discussion/Question.

You are allowed to edit your post within 30 minutes of iniitially posting it.

Gloak commented: I don't like it... I was planning to delete and post the same thing again... but I can't. +2

It's not my favourite interface but you can't please everyone. Personally, for short posts I just create the post in TextPad then copy/paste into Daniweb. For anything longer I create the post in MarkdownPad, then copy/paste. It allows me to get the formatting right before posting and it also keeps me from losing a partial post if something locks up.

Do you really think this 9-year-old post warrants further input?

rproffitt commented: Some think it does. I disagree with cause here. My findings were the lack fo Pb in the solder. +15

I know nothing about the package you are using, but since the problem is with a conversion you could try taking

return int(projectionMatrix.reshape(projectionMatrix.shape[0] / self.numberOfDotsPerFrame, self.numberOfDotsPerFrame, 2))

and break it down into components like

a = projectionMatrix.shape[0]
b = self.numberOfDotsPerFrame
c = projectionMatrix.reshape((a/b, b, 2)


return int(projectionMatrix.reshape(a / b, b, 2))   

That might give you more information on the exact problem.

Unfortunately, movies and TV have co-opted the term to mean anyone who is capable of gaining unauthorized access to a system in under two minutes, even a completely unfamiliar system. The hacker is basically the movie/TV version of deus ex machina. Check out Die Hard 4 and just about any episode of How to Get Away With Murder.

Have you considered it might be because your key has a space? Look at the following:

>>> data_2012 = {}
>>> data_2012['DeathRate '] = "some data"
>>> data_2012['DeathRate ']
'some data'
>>> data_2012['DeathRate']
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
KeyError: 'DeathRate'

You might avoid spurious spaces by using

data_2012[key.strip()] = value

You don'y need to enable the admin account. You can create a shkrtcut to an elevated task via the task scheduler. See here for details.

As I continue my conversion from vbScript to Python I am finding the gotchas. For example...

A lot of my utility scripts take a file name or a file pattern as a parameter. My script, bitrate.vbs, for example allows me to invoke it as

bitrate file
bitrate pattern

Technically file and pattern are identical since specifying a file is really just specifying a pattern that matches up to one file. To get file listings in vbScript I would just spawn a dos dir command and grab the output from stdout. In Python, however, they provide what I thought was a great module named glob. So a lot of my code looked like

for file in glob.glob(pattern):

I had rewritten five scripts before I got bitten. Let's take a folder that has videos named like

Piano Recital [1994].mp4
Awards Day [1994].mp4
Betula Lake [1983].mp4

glob.glob("*.mp4") gives the expected result

['Awards Day [1994].mp4', 'Betula Lake [1983].mp4', 'Piano Recital [1994].mp4']

so if I were to run bitrate *.mp4 I would process the expected set of files. But if I want the bitrate of only one file and type bitrate "Awards Day [1994].mp4" I get nothing because the result of `glob.glob("Awards Day [1994].mp4") is


And there is a (semi) valid reason for this. glob allows you to use character classes (a subset of regular expressions) in file patterns and [ and ] are used to delimit character classes. Fortunately, glob also provides an escape method in case your file name contains these delimiters. ...

I've only looked at a few pages

Then you have read more of the report than most of the Republicans in either House.

rproffitt commented: So there's a chance I could win a House seat? +0


Joe Biden's said in his Iowa speech

I know government is sometimes a knife-fight, but it can’t be a permanent frame of mind. So – yes — I will look to work with the Congress. I will work across the aisle. I will seek to find consensus.

He must have slept through the entire Obama presidency because Obama tried cooperation across the aisle with a party that publicly stated that its job was to prevent the Democrats from doing anything (even initiatives originally proposed by Republicanbs).

Eisenhower visited Normandy in 1964 and spoke to Walter Cronkite.

These men came here - the British, and our other allies, Americans - to storm these beaches for one purpose only, not to gain anything for ourselves, not to fulfill any ambitions that America had for conquest, but just to preserve freedom - systems of self-government around the world. Many thousands of men have died for ideals such as these.

Meanwhile, on Trump's recent visit, his "stirring" words were

This is one of the true, in terms of war, in terms of, probably you can also say, in terms of peace, because this led to something very special.

He then went on to trash Nancy Pelosi and Chuck Schumer because, well, Trump.

Oh yes, instead of Walter Cronkite, the most trusted voice in America, Trump was with Laura Ingraham of Fox News.

How did we get to this place?

I installed pyCharm and found it difficult to get used to. I found the debugging capabilities of Visual Studio 2019 much more intuitive.

As a further note, there is a py.exe and a pyw.exe in the C:\Windows folder which are the executables for the 3.7 python. Nice of Microsoft to rename them so that when I went looking for conflicting python.exe versions they didn't show up. <rude word> off Microsoft.

rproffitt commented: "Embrace, extend, extinguish." I can hear it now. "We changed it for security reasons." And thanks since I didn't know that. +15

The second link did the trick.


D:\Utils>ftype Python.File
Python.File="C:\Windows\py.exe" "%L" %*

Note that the given file does not exist. I changed it so that it now shows:

D:\Utils>ftype Python.File
Python.File="C:\Program Files\Python36\python.exe" "%L" %*

and now recognizes the import.


The first thing I thought of was environment but the only change I made was to add PYTHONPATH so that I could import from my include folder. I dummied that back out and got the same results. I still don't understand why it would make a difference whether I explicitly invoke python.exe or let Windows do it by association with the py extension. In both cases it runs the same version of python.

That sort of leads me to a gripe. Every app seems to want its own version of python. I currently have six copies of python.exe. Three for Visual Studio, two for open office, and the one I explicitly installed (the one that gets run by association). Since Visual Studio has its own copy that means it doesn't have access to pip installed packages when I use VS for debugging.

import pymsgbox
pymsgbox.alert("some text")


Traceback (most recent call last):
  File "D:\Utils\", line 1, in <module>
    import pymsgbox
ModuleNotFoundError: No module named 'pymsgbox'


D:\Utils> (message box is properly displayed)

I'm having a problem with my python installation. The packages that came with the installation work just fine but when I try to use other installed packages I run into problems. For example, I installed a package pymsgbox using pip from an admin shell. When I run a sample script from the command line as in sample, I get

ModuleNotFoundError: No module named 'pymsgbox'

but when I run it by python it works fine. Likewise if I load it into IDLE and run it from there. Suggestions?