AttributeError: class Prolog has no attribute 'dynamic' - python

I've installed pyswip on ubuntu and I followed the official documentation to do so. However, I'm still getting some issues, I found some workarounds for a couple of them and I'm still fighting with more.
Here is the code and error I'm currently getting:
>>> from pyswip import Prolog, registerForeign, Variable, Functor
>>> registerForeign(ask_question,name='ask', arity=1)
1
>>> hypothesize = Functor("hypothesize",1)
>>> Test = Variable()
>>> assertz = Functor('assertz',1)
>>> Prolog.dynamic("yes/1, no/1")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: class Prolog has no attribute 'dynamic'
Any thoughts? Thanks!

Related

ray.services.get_node_ip_address() doesn't work. ray cluster python

I am learning to use ray on a cluster from the official documentation
I just wanted to test a single functionality which is ray.services.get_node_ip_address(), but I have the following error:
>>> import ray
>>> ray.services.get_node_ip_address()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'ray' has no attribute 'services'
It is in ray._private.services.get_node_ip_address()
It seems that the location of get_node_ip_address() is changed from ray.services.get_node_ip_address() to ray._private.services.get_node_ip_address()

Cannot run python-escpos methods

I have an Epson thermal printer (TM-82), connected via USB. I am using python-escpos library (version v2.2.0) I am trying to run some of Escpos module's methods such has ln(), textln(), etc. But none of these commands work, and I get an error 'Usb' object has no attribute <method_name>. The only commands that work are text(), qrcode(), barcode(), image() and cut().
Can you guys please tell me what's wrong?
Steps to reproduce
>>> from escpos import printer
>>> p = printer.Usb(0x04b8, 0x0e11, 0)
>>> p.text('hello')
>>> p.ln()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Usb' object has no attribute 'ln'
>>> p.is_online()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Usb' object has no attribute 'is_online'
If you are using python-escpos 2.2.0, look at the source and documentation for that version.
There is no ln or is_online function in that version.

I can't start successfully boa constructor in windows7

When I start boa-constructor(boa-constructor-0.6.1.src.win32.exe) from the command line by starting the script "Boa.py", I got the message says
My python version is "python-2.7.7.msi" and I download wxPyton "wxPython3.0-win32-3.0.0.0-py27.exe"
O searched for files that contains the string "NO_3D " but I didn't get any can you help me pleaze and thanks
Actually you will require wxPython 2.8.12.1 to not get this error.
>>> import wx
>>> wx.__version__
'2.8.12.1'
>>> wx.NO_3D
0
This is a pity, because the operation …|wx.NO_3D is actually a No-Op. So you could fix this particular issue by defining wx.NO_3D somewhere.
On 2.9.5:
>>> import wx
>>> wx.__version__
'2.9.5.0'
>>> wx.NO_3D
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'NO_3D'

AttributeError: 'module' object has no attribute 'TextCalendar'

When I copy the below code in Ideone then it runs fine but it is not running in the text editor and showing the error mentioned in the subject of this post:
import calendar
c = calendar.TextCalendar(calendar.SUNDAY)
c.prmonth(2007, 7)
The complete error is:
Traceback (most recent call last):
File "calendar.py", line 1, in <module>
import calendar
File "/home/shl/Desktop/calendar.py", line 2, in <module>
c = calendar.TextCalendar(calendar.SUNDAY)
AttributeError: 'module' object has no attribute 'TextCalendar'
change the program name from calendar.py to something like calendar_code.py
This wold work properly.
Importing from builtin library when module with same name exists

python-spidermonkey object has no attribute 'eval_script' error

Using python-spidermonkey in the following way (following the guide) gives me the error AttributeError: 'spidermonkey.Context' object has not attribute 'eval_script'.
>>> import spidermonkey
>>> rt = spidermonkey.Runtime()
>>> cx = rt.new_context()
>>> cx.eval_script("1 + 2") + 3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'spidermonkey.Context' object has no attribute 'eval_script'
I experienced the same problem and I have also found this bug report:
https://launchpad.net/~pi-rho/+archive/security/+build/3866138
Installing this package on Ubuntu (12.10) worked for me:
https://launchpad.net/~pi-rho/+archive/security/+build/3866138

Categories

Resources