I can't start successfully boa constructor in windows7 - python

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'

Related

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.

AttributeError: class Prolog has no attribute 'dynamic'

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!

Mkdir typeerror in Python 2.7

I am trying to write a simple script to create a directory in my C drive called Cake using Python. I followed a tutorial and can't figure out why I am getting an error.
os.mkdir("C:\\Cake")
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
os.mkdir("C:\\Cake")
TypeError: 'str' object is not callable
There is no Cake folder that already exists and it is on my personal PC so I do have administrative access. Any help would be appreciated.
Python lets you shoot yourself in the foot rather easily sometimes. You replaced the os.mkdir() function with a string somewhere.
You must've rebound the os.mkdir name to a string earlier in your code:
os.mkdir = 'some string'
or
os.mkdir = some_name_referring_to_a_string
Find that line and correct it. If you are seeing this in the shell, reload the module with:
reload(os)
Demo:
>>> import os
>>> os.mkdir = 'Hello world!'
>>> os.mkdir('/tmp/test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object is not callable
>>> reload(os)
<module 'os' from '/Users/mj/Development/venvs/stackoverflow-2.7/lib/python2.7/os.pyc'>
>>> os.mkdir('/tmp/test')
after importing os,
you must have set os.mkdir to a string, which is shortened to str in the error.
To fix, reload the os module.
As an example,
import os
os.mkdir "stringing along playfully"
reload(os)
os.mkdir(r"C:\Cake")

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

Printing docstrings in Python 3

How do you print doc strings in python 3.1.x?
I tried with the re and sys modules as a test and I keep getting errors. Thanks
import re
print(re._doc_)
Traceback (most recent call last):
File "<pyshell#91>", line 1, in <module>
print(re._doc_)
AttributeError: 'module' object has no attribute '_doc_'
It's called __doc__, not _doc_.
import re
print(re.__doc__)
Works just fine.

Categories

Resources