I am currently working on a University Project. That's why I am not sure if I can post the code of the project, so I won't (It is pretty huge anyways).
Well, so I spent quite some time installing all the modules to get the program to run. This was a pain at first but with Anaconda I finally got all the modules installed.
Now I get this Error. I am not sure what it means. I looked at line 928 of _pswindows.py but it didn't help me.
I know this project was originally programmed on Linux starting about 2-3 years ago and I am using Windows 10 and Spyder, so maybe there lies the problem? Googling the Error didn't help either...
How could I fix this?
File "ui-test.py", line 20, in
web_ui_thread = WebUIThread(config_fln, user_config_fln, ui_par, debug=True)
File "C:\Users\Flitschi\Documents\TU\BA\WebUI\Sprechhilfe-Python-ui\bionic_voice\webui\server.py", line 125, in init
p.nice(10)
File "C:\ProgramData\Anaconda3\lib\site-packages\psutil__init__.py", line 711, in nice
self._proc.nice_set(value)
File "C:\ProgramData\Anaconda3\lib\site-packages\psutil_pswindows.py", line 635, in wrapper
return fun(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\psutil_pswindows.py", line 928, in nice_set
return cext.proc_priority_set(self.pid, value)
OSError: [WinError 87] Falscher Parameter
Related
so I found this program, "BoxParti" made by user tpvasconcelos and I think it could help me greatly with research. Sadly it uses some packages I have never used before and it's kinda problematic to get it to work for me. I didn't change anything in the code but it doesn't want to work with me. Problem is mainly with tkinter and i'm not really familiar with it. I never used GUI before so it's kinda all tricky to me. At the moment I only want to make the program work and check if it could really be useful for me. I've been trying to make it work by myself but I didn't suceed sadly. It's kinda complex for me since I haven't used python in a while + haven't really ever used GUI with anything. Below I paste the link to download the code. I run it on Python 3.8 or 2.7, on both versions i get same errors. Below the link I paste error logs. I would greatly appreciate any tip that could sort of push me in the right direction because it seems to me I'm very lost
https://github.com/TPVasconcelos/BoxParti
Traceback (most recent call last):
File "BoxParti.py", line 1493, in <module>
app = BoxParti()
File "BoxParti.py", line 53, in __init__
frame = F(container, self)
File "BoxParti.py", line 151, in __init__
self.make_plot(frame)
File "BoxParti.py", line 176, in make_plot
self.canvas.show()
AttributeError: 'FigureCanvasTkAgg' object has no attribute 'show'
This code may work in early versions of Python, e.g. python 3.5. Several things have been deprecated. That means, you have to find correct packages.
For instance, if you uncomment the following the code runs on Python 3.8.
Uncomment: #self.canvas.show() in lines; 177, 610, 646, 692, 817, 1268, 1299, 1371
also uncomment; self.canvas.get_tk_widget()#.grid(row=0, column=1), in lines 179, 819.
But it does not show 2D or 3D anime. This could be because of uncommenting self.canvas.show().
As a result, if you want to run this code, you have to find older versions required libraries. Which I do not suggest.
Instead of that, BoxParti have been expanded to mdsea, you can install mdsea which may work better.
I am working a somewhat extensive python program that uses multiprocessing. Because I wanted the user to see some progress on the console when running the program, I read about using a shared counter on stackoverflow and after a while of playing around with my code, I got it to work. As I said it's too much code to post here, but the gist is that I instantiate a multiprocessing array after the name==main line,
if __name__ == "__main__":
total_progress_counter = Array('i',[0,0])
and then during the main portion of code I pass this array to a function in other module:
some_name.plot(<other variables>,
total_progress_counter=total_progress_counter)
Then within that other function, I used the .get_lock method that I found described here on stackoverflow:
with total_progress_counter.get_lock():
total_progress_counter[0] += self.total_panels_to_plot
I also update the other component, total_progress_counter[1], in the same function. This works fine for me on my work machine, where I wrote the code, and that machine has a Centos operating system.
But, when I run it on my personal MacBook it gives the following traceback:
Traceback (most recent call last):
File "./program.py", line 775, in <module>
program.run()
File "./program.py", line 177, in run
cases_plotted = pool.map(self.__plot__, all_cases)
File "/opt/anaconda3/lib/python3.8/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/opt/anaconda3/lib/python3.8/multiprocessing/pool.py", line 771, in get
raise self._value
AttributeError: 'list' object has no attribute 'get_lock'
I have python3 version 3.8.3 on my personal machine and python3 version 3.7.4 on my work machine. Can anyone help me understand why I'm getting different behavior on these two environments? I'd be grateful, as this is meant to be software others might use on different machines.
I installed the MATLAB Engine according to this solution and it also start, but by executing it, the following error occurs:
Traceback (most recent call last):
File "<ipython-input-1-7f0848dd34ed>", line 1, in <module>
runfile('/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py', wdir='/media/geodasie/dat/Dennis/Python/PythonProgram')
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py", line 288, in <module>
eng = matlab.engine.start_matlab() # start Matlab
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/__init__.py", line 115, in start_matlab
eng = future.result()
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
EngineError: Transport stopped.
The code sequence, in which the error occurs is this one:
Path_year = fileName[19:23] + '/'
Path_month = fileName[23:25] + '/'
# read DBL file with the help of the Matlab function provided by ESA
eng = matlab.engine.start_matlab() # start Matlab
DATA = eng.main_read(path_saveFilefromFTP + Path_year + Path_month + fileName) # run matlab script
eng.quit() # end Matlab
This code was already running on another pc, but sadly on this one the error occurs.
I installed the MATLAB Engine several times but the result is the same. According to the futureresult.py function which is called, the timeout is the number of seconds it waits before returning a result. But per default the function waits, until a result is available. Because there the error occurs it seems, that the function can't provide a result.
The future result is explained as followed:
An instance of FutureResult is returned from each asynchronous invocation of a
function call: start_matlab, connect_matlab, or MatlabEngine.. The
future result serves as a placeholder of the actual result, so the future
result can be returned immediately. The actual result is placed into the
placeholder when the function finishes its evaluation.
But the program already stops by calling the engine, the MATLAB Engine, so there should be a problem in the connection between MATLAB and Python.
I use Python 3.6.5 with Anaconda 5.2 in Ubuntu 16.04 LTS and have MATLAB 2018a installed.
Update: Now I tested it at another pc and the same error occurs. It seems that it always happen after I had to activate MATLAB at this pc. Therefore I changed the title.
Does someone has an idea how to solve this?
Thanks in advance!
After many tests the only solution was to delete MATLAB and then install it again. Maybe there are better solutions but because MATLAB needed the activation beside it was already activated, I guess there was a problem with the MATLAB license and thus MATLAB didn't respond to the MATLAB Engine.
I have tried running the code found at http://computationallegalstudies.com/2009/11/15/programming-dynamic-models-in-python-3-outbreak-on-a-network/ but at the end the following shows up:
File "/Library/Python/2.7/site-packages/igraph/drawing/__init__.py", line 446, in plot
result = Plot(target, bbox, background=kwds.get("background", "white"))
File "/Library/Python/2.7/site-packages/igraph/drawing/__init__.py", line 117, in __init__
self._surface_was_created = not isinstance(target, cairo.Surface)
File "/Library/Python/2.7/site-packages/igraph/drawing/utils.py", line 396, in __getattr__
raise TypeError("plotting not available")
TypeError: plotting not available
It's a code for modelling SIR model on networks. I really need someone's help as I am not able to use a computer , a mac in this case. Thank you in advance
You need to install the Cairo library and its Python bindings for plotting. If you are using Homebrew, it is simply a matter of brew install cairo py2cairo, assuming that you use the system Python (which you seem to be, judging from the stack trace).
I read in the howto documentation to install Trigger, but when I test in python environment, I get the error below:
>>> from trigger.netdevices import NetDevices
>>> nd = NetDevices()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 913, in __init__
with_acls=with_acls)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 767, in __init__
production_only=production_only, with_acls=with_acls)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 83, in _populate
# device_data = _munge_source_data(data_source=data_source)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/__init__.py", line 73, in _munge_source_data
# return loader.load_metadata(path, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/trigger/netdevices/loader.py", line 163, in load_metadata
raise RuntimeError('No data loaders succeeded. Tried: %r' % tried)
RuntimeError: No data loaders succeeded. Tried: [<trigger.netdevices.loaders.filesystem.XMLLoader object at 0x7f550a1ed350>, <trigger.netdevices.loaders.filesystem.JSONLoader object at 0x7f550a1ed210>, <trigger.netdevices.loaders.filesystem.SQLiteLoader object at 0x7f550a1ed250>, <trigger.netdevices.loaders.filesystem.CSVLoader object at 0x7f550a1ed290>, <trigger.netdevices.loaders.filesystem.RancidLoader object at 0x7f550a1ed550>]
Does anyone have some idea how to fix it?
The NetDevices constructor is apparently trying to find a "metadata source" that isn't there.
Firstly, you need to define the metadata. Second, your code should handle the exception where none is found.
I'm the lead developer of Trigger. Check out the the doc Working with NetDevices. It is probably what you were missing. We've done some work recently to improve the quality of the setup/install docs, and I hope that this is more clear now!
If you want to get started super quickly, you can feed Trigger a CSV-formatted NetDevices file, like so:
test1-abc.net.example.com,juniper
test2-abc.net.example.com,cisco
Just put that in a file, e.g. /tmp/netdevices.csv and then set the NETDEVICES_SOURCE environment variable:
export NETDEVICES_SOURCE=/tmp/netdevices.csv
And then fire up python and continue on with your examples and you should be good to go!
I found that the default of /etc/trigger/netdevices.xml wasn't listed in the setup instructions. It did indicate to copy from the trigger source folder:
cp conf/netdevices.json /etc/trigger/netdevices.json
But, I didn't see how to specify this instead of the default NETDEVICES_SOURCE on the installation page. But, as soon as I had a file that NETDEVICES_SOURCE pointed to in my /etc/trigger folder, it worked.
I recommend this to get the verifying functionality examples to work right away with minimal fuss:
cp conf/netdevices.xml /etc/trigger/netdevices.xml
Using Ubuntu 14.04 with Python 2.7.3