Failed to run Cognitive-Face-Python-master test - python-2.7

I'm exploring the Face API. I'm using a GUI sample.
GUI link: https://github.com/Microsoft/Cognitive-Face-Python
This error occurs when I run the sample:
Traceback (most recent call last):
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\__init__.py", line 101, in
OnInit
frame = MyFrame(None)
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\__init__.py", line 80, in
__init__
self.book = MyLabelBook(self)
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\__init__.py", line 31, in
__init__
subscription_panel = SubscriptionPanel(self)
File "D:\Tin Central\programming\DOAN\Cognitive-Face-Python-
master\Cognitive-Face-Python-master\sample\view\panel_subscription.py", line
42, in __init__
subgridsizer = wx.GridSizer(rows=2, cols=2)
TypeError: GridSizer(): arguments did not match any overloaded call:
overload 1: 'rows' is not a valid keyword argument
overload 2: 'rows' is not a valid keyword argument
overload 3: not enough arguments
overload 4: not enough arguments

You probably installed wxPython 4, which is still in beta.
You need to install wxPython 3.0.2 by going here: https://sourceforge.net/projects/wxpython/files/wxPython/3.0.2.0/.
Make sure you pick the .exe corresponding to the Python version you have (32-bit or 64-bit).
The full instructions to run the sample app are here.

Related

How can I fix Google App Engine dev_appserver.py: watcher_ignore_re flag "is not JSON serializable" error? [duplicate]

This question already has answers here:
Google App Engine dev_appserver.py: watcher_ignore_re flag "is not JSON serializable"
(2 answers)
Closed 1 year ago.
I wanna first point out that I tried every answers mentioned in this thread. None of these seem to fix the issue and the question already dates a while back.
Issue
I want to run the dev_appserver.py while adding certain files to the ignore list for the watcher; this means that the skip_files is out of the question as this option removes them from being read by the server.
When I run dev_appserver.py without the --watcher_ignore_re flag, everything works fine except for the file watch. When I do run it with the flag, I get the following error:
INFO 2021-11-02 13:54:50,100 devappserver2.py:309] Skipping SDK update check.
Traceback (most recent call last):
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 109, in <module>
_run_file(__file__, globals())
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in _run_file
_execfile(_PATHS.script_file(script_name), globals_)
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in _execfile
execfile(fn, scope)
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 635, in <module>
main()
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 623, in main
dev_server.start(options)
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 356, in start
java_major_version=self.java_major_version
File "/home/USERNAME/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/metrics.py", line 185, in Start
self._cmd_args = json.dumps(vars(cmd_args)) if cmd_args else None
File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <_sre.SRE_Pattern object at 0x7f720c625240> is not JSON serializable
I have tried with different versions without success:
GCloud 361.0.0/362.0.0/357.0.0/240.0.0/220.0.0/200.0.0
Python 2.7.18/3.9.7
I have also tried different string values on the watcher flag:
""
''
".css"
"*.css"
".*\css"
'.css'
'*.css'
'.*\css'
etc.
I know the issue is therefore not with how the string is formulated (at least it doesn't seem like it). And the different version don't help either.
My work colleagues don't have this issue and are using different versions I listed here on MacOS. I am currently on arch Linux, but I have ran into the exact same issue on my mac as well.
I have also added export CLOUDSDK_PYTHON=python2.7 in my ~/.zshrc file.
So turns out this was a duplicate after all. I missed one comment that had the solution. This one: https://stackoverflow.com/a/52238832/9706597
It looks like it is an issue with the google analytics code built into dev_appserver2 (google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py on or around line 316). It wants to send all of your command line options to google analytics. If you remove the analytics client id by adding the command line option --google_analytics_client_id= (note: '=' without any following value) the appserver won't call the google analytics code where it is trying to JSON serialize an SRE object and failing.
In a few short words for anyone else coming through here, simply add this option, simply add this option:
--google_analytics_client_id= with no value.

Why does a decision variable domain declaration not work in Pyomo v5.7 that worked with v5.6.9

I have a decision variable declaration that does not work in Pyomo 5.7 that did work in 5.6.9.
The line in question is part of building a (concrete) model:
model.v = pe.Var(within = pe.RealSet) #pe = pyomo.environ
This ran fine when I had Pyomo version 5.6.9, but now gives errors described below in the provided code block.
To run with 5.7 I had to drop the within statement so I am left with:
model.v = pe.Var()
What is the reasoning for no longer supporting an explicit statement that the domain includes all reals?
When running with the original statement with Pyomo 5.7, I get this error (CPython 3.7.1 on Windows 10):
ERROR: Constructing component 'v' from data=None failed: TypeError: __new__()
takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "runscript.py", line 216, in <module>
payoff_matrix = my_matrix
File "C:\Users\myusername\Documents\modelbuildscript.py", line 24, in __init__
model.v = pe.Var(within = pe.RealSet)
File "C:\EngTools\Anaconda3\2018.12\lib\site-packages\pyomo\core\base\block.py", line 543, in __setattr__
self.add_component(name, val)
File "C:\EngTools\Anaconda3\2018.12\lib\site-packages\pyomo\core\base\block.py", line 1081, in add_component
val.construct(data)
File "C:\EngTools\Anaconda3\2018.12\lib\site-packages\pyomo\core\base\var.py", line 613, in construct
self._initialize_members((None,))
File "C:\EngTools\Anaconda3\2018.12\lib\site-packages\pyomo\core\base\var.py", line 682, in_initialize_members
self.domain = self._domain_init_rule(self._parent())
TypeError: __new__() takes 1 positional argument but 2 were given
The short answer is that you should use
model.v = pe.Var(within=pe.Reals)
The slightly longer answer is that the Pyomo global sets (Reals, NonNegativeReals, Integers, PositiveIntegers, Binary, etc.) were originally defined using their own class hierarchy independent of the Set and RangeSet components. Unfortunately, that led to numerous problems (correctly detecting discrete sets, performing set operations using global sets, etc). Pyomo 5.7 switched to a new rewrite of the Set / RangeSet components that among numerous other bug fixes moved to a new paradigm where all sets in Pyomo were either Set or RangeSet components (even global sets). We put in a backwards compatibility layer that caught all the legacy uses of the RealSet class in the test suite, but your use case (while it worked) was not a documented / tested case. PR 1619 will restore this functionality (likely will be included in Pyomo 5.7.1), and adds an official deprecation warning for use of RealSet.

unable to call glCreate* in pyOpenGL

I'm running a code using pyopengl and have some problems of calling glCreate* functions.
The code is running in ubuntu 16.04, python2.7 and the pyopengl version is PyOpenGL 3.1.3b2 and PyOpenGL-accelerate 3.1.3b2 (already the latest versions).
It has the flowing problems:
when I try to call
>>> glCreateTextures
OpenGL.platform.baseplatform.glCreateTextures object at 0x7f16de11a050
It seems that the updated version of pyopengl does add this function (or class) but it's creepy that if I try to give it values for initializing:
>>> glCreateTextures(None,None,None)
Traceback (most recent call last):
File "", line 1, in
File "/media/sinnis/ADDDISK/pyopengl/OpenGL/latebind.py", line 41, in call
return self._finalCall( *args, **named )
File "/media/sinnis/ADDDISK/pyopengl/OpenGL/wrapper.py", line 689, in wrapperCall
result = wrappedOperation( *cArguments )
File "/media/sinnis/ADDDISK/pyopengl/OpenGL/platform/baseplatform.py", line 414, in call
self.name, self.name,
OpenGL.error.NullFunctionError: Attempt to call an undefined function glCreateTextures, check for bool(glCreateTextures) before calling
It seems that the it is checking and considering this call an undefined function. That's how it raises problem in the script texture.py and I find that any glCreate* calls has this problem.
Still no solution to fix this problem. Help!

Can't import wx (wxPython Phoenix) into my script

I'm taking a course in Python, and the current assignment is to convert a previous assignment written in Python 2 (which used wxPython) to Python 3 (which needs Phoenix). I successfully installed Phoenix, and in the Py3 shell I can now import wx just fine. However, if I try to run my actually script, it immediately gets this error:
Traceback (most recent call last):
File "C:\Python27\transferdrillPy3.py", line 10, in
class windowClass(wx.Frame):
NameError: name 'wx' is not defined
What's up with that?
I tried going through my code and deleting every single "wx.", and now it works. I guess Phoenix doesn't need that.

definition of qwtplot

it's my first post, hope to not break something :).
On windows there are two versions of python2.7, 32 bit and 64 bit both with pyqt and qwt5
i'm trying pyqt from some week, today i tried to use my python/pyqt/pyqwt code written on linux, on windows, but the prompt says:
C:\Users\bomba\Desktop\conversione_python\guibms>python-32 interfaccia_mark3.2.p
y
Traceback (most recent call last):
File "interfaccia_mark3.2.py", line 14, in <module>
from PyQt4.Qwt5.qplt import *
File "C:\Python27-32bit\lib\site-packages\PyQt4\Qwt5\qplt.py", line 95, in <mo
dule>
Y1 = Left = QwtPlot.yLeft
NameError: name 'QwtPlot' is not defined
someone could explain me this?
I would really apppreciate
You haven't defined the Qwtplot object.
Try using:
import PyQt4.Qwt5 as Qwt
plot = Qwt.QwtPlot()
and then use the plot object as you wish.