Comments (4)
It's worth noting that if, in the second example, you use different names for env
and db
(env2
and db2
), the segfault doesn't happen. Something to do with the destructor I'm sure, just not quite clear on what's going on here.
from sophy.
Working on a rewrite which will fix this and also support the latest version 2.2. It's in a branch and I anticipate merging in the next day or so.
from sophy.
This is fixed in master. The latest changes are also deployed to PyPI as version 0.2.0.
To fully support Sophia's multi-field key and value schema, Sophy has a new API for instantiating environments. Here is the equivalent code in Sophy 0.2.0:
from sophy import *
env = Sophia('/tmp/sophy-gh-10')
schema = Schema(key_parts=[StringIndex('key')], value_parts=[StringIndex('val')])
db = env.add_database('foo', schema)
env.open() # True
db['a'] = 'xxx'
db['b'] = 'yyy'
db['c'] = 'zzz'
env.close() # True
env.open() # True
for key, value in db:
print key, value
# a xxx
# b yyy
# c zzz
env.close()
env = Sophia('/tmp/sophia-gh-10')
db = env.add_database('foo', schema)
env.open() # True
for key, value in db:
print key, value
# a xxx
# b yyy
# c zzz
env.close() # True
from sophy.
Thanks!
from sophy.
Related Issues (15)
- Can't create new environment HOT 6
- Python3 ? HOT 8
- all the value i get from sophy is None while key was correct HOT 5
- Querying a part of index and value? HOT 1
- Segmentatoin fault when key is U32Index HOT 1
- Project License HOT 1
- How to re-open existing database? HOT 2
- Import Error undefined symbol: PyString_FromStringAndSize HOT 1
- Unable to create new database. KeyError: 'db-test' HOT 1
- Segfault HOT 1
- Closing database safely HOT 2
- Encoding problems? HOT 3
- How to limit the memory used by sophia HOT 1
- unbound memory problem HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sophy.