I'm not sure if Grail browser is a good choice nowadays, however I want to try it, because I have some problems about graphics running on Firefox-Fermi. The next, is what I obtain after trying grail-0.6 (tgz)
# python grail.py
Traceback (most recent call last):
File "grail.py", line 43, in ?
from Tkinter import *
After installing "tkinter" adequately, I run "grail.py" again, and I get
# python grail.py
/root/grail-0.6/grailbase/app.py:6: Deprecation Warning: the regex module is
deprecated; please use the re module
import regex
/usr/lib/python2.4/regsub.py:15: DeprecationWarning: the regsub module is
deprecated; please use re.sub()
DeprecationWarning)
Traceback (most recent call last):
File "grail.py", line 499, in ?
main()
File "grail.py", line 108, in main
app = Application(prefs=prefs, display=display)
File "grail.py", line 248, in __init__
self.stylesheet = Stylesheet.Stylesheet(self.prefs)
File "/root/grail-0.6/Stylesheet.py", line 21, in __init__
self.load()
File "/root/grail-0.6/Stylesheet.py", line 45, in load
massaged.append((g, c), v % fparms_dict)
TypeError: append() takes exactly one argument (2 given)
but now, I'm not able to understand the message at all. May you advice me about this problem?
Wow - that's a blast from the past! My advice is to give up: Grail hasn't been touched in more than a dozen years. It's dead.
The error message you're getting stems from a change made way back in Python 1.6 (released 5 September 2000). Here's the message from the release notes:
The append() method for lists can no longer be invoked with more
than one argument. This used to append a single tuple made out of
all arguments, but was undocumented. To append a tuple, use
e.g. l.append((a, b, c)).
So, you can:
Give up. Recommended ;-)
Install an ancient version of Python; or,
Change that line to
massaged.append(((g, c), v % fparms_dict))
and see what breaks next ;-)
About the next problem
Python 0.9.1 is extremely old, from early 1991. The language changed in many, many ways before 1.0 was released.
According to the old Grail home page, Grail 0.6:
requires Python 1.5 or newer, and Tcl/Tk 8.0 or newer.
So find Python 1.5 if you're determined to pursue this ;-) Note that the .append() semantics were changed in version 1.6, so the original .append() code that hurt you at first should still work OK in 1.5.
Related
I try to run code to send a UDS extended diagnostics request on CAN
from uds import Uds
PCM = Uds(resId=0x200, reqId=0x250, transportProtocol="CAN", interface="vector", channel="0", appName="CANoe")
response = PCM.send([0x10, 0x03])
But I get following Type error:
Traceback (most recent call last):
File "C:\__work__\Karol_projects\main.py", line 26, in <module>
PCM = Uds(resId=0x200, reqId=0x250, transportProtocol="CAN", interface="vector", channel="0", appName="CANoe")
File "C:\__work__\Karol_projects\venv\lib\site-packages\uds\uds_communications\Uds\Uds.py", line 43, in __init__
self.tp = tpFactory(self.__transportProtocol, configPath=configPath, **kwargs)
File "C:\__work__\Karol_projects\venv\lib\site-packages\uds\uds_communications\TransportProtocols\TpFactory.py", line 37, in __call__
return CanTp(configPath=configPath, **kwargs)
File "C:\__work__\Karol_projects\venv\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanTp.py", line 96, in __init__
self.__connection = canConnectionFactory(self.callback_onReceive,
File "C:\__work__\Karol_projects\venv\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanConnectionFactory.py", line 52, in __call__
CanConnectionFactory.connections[connectionKey] = CanConnection(callback, filter,
File "C:\__work__\Karol_projects\venv\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanConnection.py", line 21, in __init__
listener = can.Listener()
TypeError: Can't instantiate abstract class Listener with abstract method on_message_received
I have seen similar posts but anyway I can't get a proper solution. I only imported python-can and python-uds modules and had tried to send a can message. I don't have much experience with OOP especially with abstract classes.
python-uds is an older library, and hasn't seen new releases in 3 and half years now (version 1.0.2 was released in March 2019). python-can on the other hand, has made major strides in that time, and released a major update, version 4.0.0 in February 2022. That release is fundamentally incompatible with python-uds, causing the traceback you see.
You have two options:
Downgrade python-can; when python-uds was last released, python-can had released version 3.1.1, but it may be that later 3.x.x versions also work. See the python-can release page on PyPI for the full list. You could try reading the python-can changelog to see if something stands out if the last 3.x release, 3.3.4, doesn't work but 3.1.1 does to see what the latest version that works would be. Or, just bisect the versions between 3.3.4 and 3.1.1 until you find the last compatible release.
Switch to a different Uds library. The py-uds project has seen more recent releases (version 0.2.0 was released in December last year and their GitHub repository shows active development continued up to February 2022 at least.
the version of python is 3.6
I tried to execute my code but, there are still some errors as below:
Traceback (most recent call last):
File
"C:\Users\tmdgu\Desktop\NLP-master1\NLP-master\Ontology_Construction.py",
line 55, in
, binary=True)
File "E:\Program
Files\Python\Python35-32\lib\site-packages\gensim\models\word2vec.py",
line 1282, in load_word2vec_format
raise DeprecationWarning("Deprecated. Use gensim.models.KeyedVectors.load_word2vec_format instead.")
DeprecationWarning: Deprecated. Use
gensim.models.KeyedVectors.load_word2vec_format instead.
how to fix the code? or is the path to data wrong?
This is just a warning, not a fatal error. Your code likely still works.
"Deprecation" means a function's use has been marked by the authors as no longer encouraged.
The function typically still works, but may not for much longer – becoming unreliable or unavailable in some future library release. Often, there's a newer, more-preferred way to do the same thing, so you don't trigger the warning message.
Your warning message points you at the now-preferred way to load word-vectors of that format: use KeyedVectors.load_word2vec_format() instead.
Did you try using that, instead of whatever line of code (not shown in your question) that you were trying before seeing the warning?
I write below code and it gives me error in first line! whats wrong is with this code:
import volatility.conf as conf
import volatility.registry as reg
import volatility.commands as commands
import volatility.addrspace as addrspace
import volatility.plugins.taskmods as taskmode
# configure volatility
reg.PluginImporter()
config=conf.ConfObject()
reg.register_global_options(conf,commands.Command)
reg.register_global_options(conf,addrspace.BaseAddressSpace)
config.parse_options()
config.PROFILE="Linuxfedora32x64"
config.LOCATION="./dumps/mem.lime"
p=taskmode.PSList(config)
for process in p.calculate:
print(process)
the error code:i think there is some code insode conf.py witch in not support in python 3.6 .but volatility is copatible with python 3.6. so i don't know what to do :
Traceback (most recent call last):
File "../PycharmProjects/volpractive/test.py", line 6, in <module>
import volatility.conf as conf
File "/anaconda3/lib/python3.6/site-packages/volatility-2.6-py3.6.egg/volatility/conf.py", line 84
except (optparse.BadOptionError, optparse.OptionValueError), err:
You were right, the line:
except (optparse.BadOptionError, optparse.OptionValueError), err:
is not Python3 compatible (according to [Python]: The try statement).
According to [GitHub]: volatilityfoundation/volatility - (2.6) volatility/README.txt:126+ (as it is at this point):
Requirements
============
- Python 2.6 or later, but not 3.0. http://www.python.org
Note:
The stacktrace is still incomplete (missing the last line - should be SyntaxError); that would have cleared things up much sooner
So, you have to run it with Python2.6+ (of course you could also modify the code (at least the part that you need) to be Python3 compatible, but I doubt that's feasible).
In Python 2.7, 3.4 and 3.5, grp.getgrgid is capable of accepting a string:
from grp import getgrgid
print(getgrgid('0'))
However, pwd.getpwuid can't do the same:
from pwd import getpwuid
print(getpwuid('0'))
Traceback (most recent call last):
File "getpwuid_test.py", line 2, in <module>
print(getpwuid('0'))
TypeError: an integer is required
This is because inside Modules/pwdmodule.c, getpwuid uses PyNumber_ParseTuple with a converter that uses PyNumber_Index to get a Python integer, and that raises an exception on failure.
However, in Modules/grpmodule.c, grp_getgrgid uses PyNumber_Long (Or PyNumber_Int for an old enough Python) as a conversion first, and as the documentation says at https://docs.python.org/3/c-api/number.html, this is the equivalent of running int(o), which can convert a string to an integer. Only then is it given to PyNumber_Index, by way of a helper function _Py_Gid_Converter
What is the reason for this difference? Is it a deliberate choice based on some history?
The behaviour of getgrgid seems more helpful, and it's odd that it doesn't apply to both functions. Is this undesirable behaviour in getgrgid or getpwuid?
The short answer is because humans are fallible and mistakes happen. Some are doozies and get noticed quickly, others are minor and can go years without detection.
Thank you for helping make Python better!
Currently I'm working with 3D objects rendering. In that while dealing with framebuffer part I'm getting some error.
self.fbo = glGenFramebuffers(1)
whenever interpreter hits this line its showing following error
**File "C:\Python27\lib\site-packages\OpenGL\latebind.py", line 44, in __call__
self._finalCall = self.finalise()
File "C:\Python27\lib\site-packages\OpenGL\extensions.py", line 189, in finalise
self.__name__,
NullFunctionError: Attempt to call an undefined alternate function (glGenFramebuffers, glGenFramebuffersEXT), check for bool(glGenFramebuffers) before calling**
I'm using python 2.7.3 and pyOpenGL 3.0.2.I couldn't find any answer for this error.
If bool(glGenFramebuffers) returns False, the error probably means that your computer does not have access to OpenGL >= 2.1 so Framebufffer objects won't work. Check your OpenGL supported version with GPU Caps Viewer for Windows. For Linux see here: https://askubuntu.com/questions/47062/what-is-terminal-command-that-can-show-opengl-version
If you have at least 2.1, then maybe the library you are using to create the context (pySDL, glut, pySFML, etc.) is not creating a compatible one. Fixing that depends on the library and probably already has an answer.
If bool(glGenFramebuffers) returns True, the problem might be somewhere else early in the code.
Also, remember that the context must be created and current before trying to create or use shaders, framebuffers, etc.