bpython
bpython - A fancy curses interface to the Python interactive interpreter
Home - the bpython interpreter
For my django projects, I wanted to write a simple replacement for manage.py shell
to take advantage of bpython. Essentially all it does is run setup_environ(settings)
and then import some common models (User, etc.)
in any case, everything works fine when I run bpython -i bshell.py
(my script is named bshell.py). Then I thought I'd get clever and set the hashbang line to #!/usr/bin/env bpython -i
to make it even simpler, and this worked on the OSX but is not working now in Ubuntu (10.10).
#!/usr/bin/env python -i
also does not work, but #!/usr/bin/env bpython
works (but obviously doesn't drop into the interactive prompt).
It's a small point, but over the course of my life it will save me hundreds of "bpython -i"s if I can just run my script as ./bshell.py
(really I'm just curious). Any ideas why it's not working on Ubuntu?
I should note I'm in a virtualenv, and I already double checked that line endings are *nix style.
Source: (StackOverflow)
I need to import a mesh animation from Cinema4D into Blender.
I tried to do that using Collada.The Collada 1.3 importer doesn't seem to
do anything, the Collada 1.4 importer seems to work, but the animation didn't get
imported into Blender.
After reading this post:
Problem solved!
In case anyone comes in here looking
for the answer, I spoke to Otomo via
email and he kindly explained that the
problem lies in the .dae file being
exported incorrectly from C4D.
I hope Otomo doesn't mind me quoting
his email, I just don't want other
people to waste the time I did on such
a stupid problem.
Open up the .dae in a text editor and
change:
data
data
to this:
data
data
The fps must also be the same in both
c4d and blender.
I tried that, but I get an error:
FEEDBACK: Illusoft Collada 1.4 Plugin v0.3.162 started
The minor version of the file you are using is newer then the plug-in, so errors may occur.
image not found: None
Traceback (most recent call last):
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/cstartup.py", line 681, in ButtonEvent
onlyMainScene, applyModifiers)
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 120, in __init__
self.__Import(fileName)
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 127, in __Import
documentTranslator.Import(fileName)
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 333, in Import
self.sceneGraph.LoadFromCollada(self.colladaDocument.visualScenesLibrary.items, self.colladaDocument.scene)
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 550, in LoadFromCollada
ob = sceneNode.ObjectFromDae(daeNode)
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 2079, in ObjectFromDae
a.LoadFromDae(daeAnimation, daeNode, newObject)
File "/Applications/blender/blender.app/Contents/MacOS/.blender/scripts/bpymodules/colladaImEx/translator.py", line 1254, in LoadFromDae
interpolationsSource = daeAnimation.GetSource(interpolations.source)
AttributeError: 'NoneType' object has no attribute 'source'
Has anyone come across this issue ? Where can I find a newer Collada importer ?
Any hints on modifying the importer ?
Note:
Blender 2.5a2 imports collada animations, but the coordinate system is different and not all animation makes it through. For example, when I animate a box from 0,0,0 to 100,100,100,
rotate it on x,y,z and scale it on x,y,z, in Blender I get: translation on 1 axis(x which originally is y in cinema 4d), rotation is fine, scale is ignored.
Source: (StackOverflow)
I've been using bpython for a while now for all of my Python interpreting needs. It's delightful, particularly when you're using unfamiliar new libraries, or libraries with a multitude of functions. In any case, it's nice to have a bpython interpreter running alongside what I'm doing, but it'd be even better if I had both the autocomplete-like feature, and the parameter description in the manner that bpython does while I'm editing code in Emacs. Am I completely crazy? Does anyone have an idea on how to do this?
Thanks,
Bradley Powers
Source: (StackOverflow)
I've started using bpython for my python interpreting needs. I like the syntax highlighting and the tab completion mode. I'd like to get bpython working in emacs (note: simply running the bpython command in shell mode doesn't work) so that I can achieve Python nirvana. Any recommendations on how to get started writing an emacs plugin to do this?
Thanks,
Bradley Powers
Source: (StackOverflow)
I'm currently developping a Django application and I like using the pdb to know in which state is my application and some stuff like that. I would like to have all the amazing capabilites of BPython inside the debuger... Like autocompletion and things like that.
Is that even possible ? Thanks :)
Source: (StackOverflow)
Apparently I've unlearned how to debug with python.
I run bpython3 -i myfile.py
, but when an exception occurs I still don't have access to the program variables, nor I can find any command like gdb
's up
and down
.
I've tried to import pdb
and play around with it, but I didn't manage to obtain much. And it definitely isn't integrated into bpython in any way.
As far as I remember, it was pretty straightforward, like gdb
, but apparently I remember uncorrectly and now I'm clueless. Information online about python debuggers is confused, vague, and I couldn't find anything similar to what I was using before, so I came to ask here: am I missing something obvious?
Source: (StackOverflow)
For example, when I type
from some.module import a
I get list of what begins with "a"
How can I get the whole list, not for only "a" or other letter?
Source: (StackOverflow)
Is it possible to start the bpython interpreter so that it always runs some custom commands when it launches?
In my case I simply want to do:
import numpy as np
import matplotlib.pyplot as plt
I can't see anything in the docs. Anyone know a way?
Source: (StackOverflow)
Using Blender 2.49's Python API I'm creating a mesh.
I have a list of vertices and a list of face indices.
e.g.
mesh = bpy.data.meshes.new('mesh')
mesh.verts.extend(mVerts)
mesh.faces.extend(mFaces)
I've noticed MVert's uvco property and MFace's uv
property, and added some random values, but I can't see any
change when I render.
Regarding uvco, the documentation mentions:
Note: These are not seen in the UV editor and they are not a part of UV a UVLayer.
I tried this with the new mesh selected:
import Blender
from Blender import *
import random
scn = Scene.GetCurrent()
ob = scn.objects.active
o = ob.getData()
for v in o.verts:
v.uvco = (random.random(),random.random(),random.random())
print v.uvco
for f in o.faces:
r = (random.random(),random.random())
for i in range(0,4):
f.uv.append(r)
print f.uv
I can see the values change in Terminal, but I don't see any change when I render.
If I reselect the object, the previous face uvs are gone.
Can anyone explain how are UVs set using the Blender 2.49 Python API ?
Thanks
Source: (StackOverflow)
I am using bpython
for interactive python sessions and since I updated my system, I have the following problem:
In bpython3
:
>>> import sys
>>> sys.stdout.flush
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'FakeStream' object has no attribute 'flush'
However, in python3
:
>>> import sys
>>> sys.stdout.flush
<built-in method flush of _io.TextIOWrapper object at 0x7fab6b7fb708>
The same for ipython3.
So why does sys.stdout
not have the attribute flush
in bpython3
? I have searched for the actual source code of the sys
module, but couldn't find it, no sysmodule.c
file or something like that. Doesn't bpython
use the same code for this module as the other clis?
$ bpython3 --version
bpython version 0.12 on top of Python 3.4.2
(C) 2008-2012 Bob Farrell, Andreas Stuehrk et al. See AUTHORS for detail.
$ python3 --version
Python 3.4.2
Source: (StackOverflow)
I have created a virtualenv and installed SQLAlchemy in it:
$ virtualenv alchemy
$ source alchemy/bin/activate
$ pip install sqlalchemy
import
works in python:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
>>> print sqlalchemy.__version__
0.9.7
But it does not work in bpython:
>>> import sqlalchemy
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named sqlalchemy
Why can't bpython find the package installed in the virtualenv, even though it is executed after source alchemy/bin/activate
is called?
Source: (StackOverflow)
I love bpython's fast, comprehensive autocompletion and I'd really like to use it right inside my editor/IDE. Is there a way to integrate it into vim/gedit/eclipse/etc?
Thanks.
Source: (StackOverflow)
In irb we can do:
>> load 'example.rb'
Which loads the source of example.rb
in to environment.
What is alternative for bpython and ipython?
Source: (StackOverflow)
I really admire bpython with its nice coloring and autocomplete, autohint and so on.
The problem is, that there are some features in ipython which I can't get with out, for examble reload, magic commands, matplotlib interacting, the shell interaction, the Vim interaction or the ipython notebook. I know there is also autocomplete in ipython, but its not as nice as in bpython.
is there a way to put bpython in ipython?
//edit: Checkout this: http://bipython.org/
Source: (StackOverflow)