Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能不能替换掉mmap模块 #4

Closed
jhack77 opened this issue Oct 3, 2014 · 4 comments
Closed

能不能替换掉mmap模块 #4

jhack77 opened this issue Oct 3, 2014 · 4 comments

Comments

@jhack77
Copy link

jhack77 commented Oct 3, 2014

我的应用布署在sae上面,我想是否可以个性一个通用的版本,当然可能会增加系统开销。替换掉mmap模块。使用更为通用的stringio 之类的。异或是可以提供转换dat至数据库的方法。。。。

@jhack77 jhack77 changed the title 能不能进mmap模块 能不能替换掉mmap模块 Oct 3, 2014
@lxyu
Copy link
Owner

lxyu commented Oct 8, 2014

这个在 sae 不支持 mmap 有没有具体的 exception?比如说 ImportError?

@lepture,可以考虑加个 fallback。

@jhack77
Copy link
Author

jhack77 commented Oct 10, 2014

@lxyu 在sae 禁用了mmap,导入时提出没有模块名字叫mmap ,在google上查询了下,发现google app engine 上面也是禁用了mmap,新浪应该学习的google ,去掉此模块是为了安全问题。
googe app engine上面也有人要解析ip dat的。所以我找到了这样的一个页面。http://stackoverflow.com/questions/4608239/using-pygeoip-on-appengine-no-module-named-mmap
希望能改进下此模块

@lepture lepture mentioned this issue Oct 11, 2014
@lxyu
Copy link
Owner

lxyu commented Oct 11, 2014

fixed in #5

@lxyu lxyu closed this as completed Oct 11, 2014
@jhack77
Copy link
Author

jhack77 commented Oct 11, 2014

可用,请问下
offset = self._offset + data_pos - 1024 这里为什么要减去1024
value = self._buf[offset:offset + data_length]

对dat文件不太熟悉,不明白减去1024的原因。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants