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

I got this error: AttributeError: 'module' object has no attribute 'load' #4

Closed
GoTop opened this issue Feb 20, 2016 · 3 comments
Closed
Assignees

Comments

@GoTop
Copy link

GoTop commented Feb 20, 2016

import pysubs2
pysubs2.load('subtitle.ass','utf-8')
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'load'

I use pysubs2 in Django

I think there maybe some problem about import path, but I can't figure it out.

could you check this?

could you check it

@GoTop
Copy link
Author

GoTop commented Feb 20, 2016

oh, I just know that pysubs2 was writed in Python3, and I am using Python 2.7

@GoTop GoTop closed this as completed Feb 20, 2016
@tkarabela
Copy link
Owner

Hi, pysubs2 works with 2.7, it must be something else.

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysubs2
>>> subs = pysubs2.load("c:/subs.ass")
>>> subs
<SSAFile with 943 events and 45 styles, last timestamp 0:25:40>

Since you don't get an ImportError, try printing pysubs2.__file__. I think the problem is that you have a file named pysubs2.py somewhere, and Python imports that script instead of the library it should. If the very script you're trying to use pysubs2 from is called pysubs2.py, the script will happily import itself without an ImportError... I was bitten by this many times myself :-)

@tkarabela tkarabela reopened this Feb 20, 2016
@tkarabela tkarabela self-assigned this Feb 20, 2016
@tkarabela
Copy link
Owner

Python 2.7 is EOL and we're going to drop support for it in the next release, closing the issue.

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