#9623 closed defect (fixed)
IOError: (22, "invalid mode ('r') or filename")
Reported by: | admin | Owned by: | jomae |
---|---|---|---|
Priority: | low | Component: | AccountManagerPlugin |
Severity: | normal | Keywords: | needinfo IOError |
Cc: | Trac Release: | 0.11 |
Description
How to Reproduce
While doing a POST operation on /admin/accounts/users
, Trac issued an internal error.
(please provide additional details here)
Request parameters:
{'__FORM_TOKEN': u'7097c8ea2f72cafa1fb30eea', 'add': u' Add ', 'cat_id': u'accounts', 'email': u'tpradeeppai@gmail.com', 'name': u'vipin', 'panel_id': u'users', 'password': u'vipin123', 'password_confirm': u'vipin123', 'path_info': None, 'username': u'vipin'}
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.2 Safari/535.11
System Information
Trac | 0.12.2
|
Babel | 0.9.5
|
Genshi | 0.6
|
mod_wsgi | 3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
|
pysqlite | 2.6.0
|
Python | 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
|
setuptools | 0.6c11
|
SQLite | 3.6.2
|
Subversion | 1.6.15 (r1038135)
|
jQuery | 1.4.2
|
Enabled Plugins
tracaccountmanager | 0.3.2
|
Python Traceback
Traceback (most recent call last): File "build\bdist.win32\egg\trac\web\main.py", line 511, in _dispatch_request dispatcher.dispatch(req) File "build\bdist.win32\egg\trac\web\main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "build\bdist.win32\egg\trac\admin\web_ui.py", line 116, in process_request path_info) File "build\bdist.win32\egg\acct_mgr\admin.py", line 137, in render_admin_panel return self._do_users(req) File "build\bdist.win32\egg\acct_mgr\admin.py", line 240, in _do_users _create_user(req, env, check_permissions=False) File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 148, in _create_user acctmgr.set_password(username, password) File "build\bdist.win32\egg\acct_mgr\api.py", line 292, in set_password if store.set_password(user, password, old_password): File "build\bdist.win32\egg\acct_mgr\htfile.py", line 56, in set_password self.userline(user, password)) File "build\bdist.win32\egg\acct_mgr\htfile.py", line 106, in _update_file f = open(filename, 'r') IOError: [Errno 22] invalid mode ('r') or filename: ''
Attachments (0)
Change History (19)
comment:1 Changed 13 years ago by
Component: | SELECT A HACK → AccountManagerPlugin |
---|---|
Owner: | changed from anonymous to Steffen Hoffmann |
comment:2 Changed 13 years ago by
Keywords: | needinfo added |
---|
comment:3 Changed 13 years ago by
Keywords: | IOError added |
---|---|
Priority: | normal → low |
I step this down to show my depreciation about lack of ongoing communication on this issue. Dropping something into a bug tracker and neither leaving contact information nor returning to the issue to respond on comments and updates, this suggests a lack of sense for responsibility and respect to all persons caring for the code.
Prove me wrong, would still appreciate your response with more configuration details. If this has been resolved, a note on the solution would be great too, so that someone looking for help in a similar case could pick it up here.
comment:4 follow-ups: 5 8 Changed 13 years ago by
it doesn't accept PATH using spaces, a common python error.
comment:5 Changed 13 years ago by
Keywords: | needinfo removed |
---|
Replying to anonymous:
it doesn't accept PATH using spaces, a common python error.
This would explain the error indeed. Thanks for the pointer. OTOH I question, who in his/her right mind would want a path with spaces. I call it a common Windows OS failure to educate/encourage users to sacrifice easy things without benefit.
Anyway, could someone suggest a fix too? I'd even care for silly system architecture, but must rely on independent testers to encourage me to do so.
comment:7 Changed 13 years ago by
I had this problem for a different reason. I was using htdigest_file instead of password_file, the documentation about (acct_mgr >= 0.4) to use htdigest_file was confusing. I thought I have downloaded AccountManagerPlugin for 0.11, which is >0.4. Wasted an hour to find out they refer to totally different thing!
Hope that helps somebody else.
comment:8 Changed 12 years ago by
Replying to anonymous:
it doesn't accept PATH using spaces, a common python error.
Great to know, but what is the common cure to this common mistake then? Enlighten me, please.
comment:9 Changed 12 years ago by
Keywords: | needinfo added |
---|
Since it could likely resolved by using paths without white-space, this issue has not much importance.
And in the absence of suggestions for a fix this might even become a wont-fix.
comment:11 Changed 12 years ago by
Please post the [account-manager]
and [components]
sections of trac.ini
if you wish for us to help with further diagnosis. As comment:7 noted and as we've found in #10643, the reporter's issue is most likely due to using AccountManager 0.4.0
and later configuration options with AccountManager 0.3.2
.
Based on findings in #10643, I don't think this issue is caused by whitespace in the path, but rather using htpasswd_file
or htdigest_file
options with AccountManager 0.3.2
. With AccountManager 0.3.2
, the password_file
option needs to be specified . However, please don't use that as a fix, but rather just go ahead with the upgrade to 0.4.2
.
comment:12 Changed 12 years ago by
If you follow #10643 at all, you'll see that we have a resolution of worksforme, and the issue was as suggested in comment:11. I'll leave it to the discretion of hasienda, but suggest that we close this ticket with release 0.5 of AccountManagerPlugin, if no reply is heard from the original reporter.
comment:13 Changed 11 years ago by
I faced the exact same issue while upgrading the account manager plugin from v3 to v4. After some searching found that a key parameter name has changed in v4 (password_file to htpasswd_file).
If the v4 egg file is deployed, without updating the trac.ini entries, this error occurs, as the value for the new key name is not defined. Once i put a new entry for htpasswd_file, all was well.
Hope this helps.
comment:15 Changed 8 years ago by
#12848 was closed as duplicate.
The same issue is frequently reported to AccountManagerPlugin. I think we should raise a TracError
rather than an IOError
/OSError
when the option is not configured:
-
accountmanagerplugin/trunk/acct_mgr/htfile.py
diff --git a/accountmanagerplugin/trunk/acct_mgr/htfile.py b/accountmanagerplugin/trunk/acct_mgr/htfile.py index 79a48cd..1df3b62 100644
a b class AbstractPasswordFileStore(Component): 87 87 Returns `True` if a line matching `prefix` was updated, 88 88 `False` otherwise. 89 89 """ 90 if not self.filename: 91 option = self.__class__.filename 92 raise TracError(_("[%(section)s] %(name)s option for the password " 93 "file is not configured", 94 option.section, option.name)) 90 95 f = None 91 96 filename = str(self.filename) 92 97 matched = False
comment:16 Changed 8 years ago by
Owner: | changed from Steffen Hoffmann to Ryan J Ollos |
---|---|
Status: | new → accepted |
comment:18 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:19 Changed 8 years ago by
Owner: | changed from Ryan J Ollos to jomae |
---|
The plugin is working fine in production elsewhere, so this seems like a local installation/configuration issue rather than a software bug, and only the last one would belong here.
Basically you may not have the required file specified for your authentication store, so the error tells ... or
filename: ''
. Mode 'r' can't be invalid, if the file exists.General advise: Please use the th-users mailing-list first, and even before that see wiki:CookBook/AccountManagerPluginConfiguration or the appropriate section in wiki:AccountManagerPlugin/AuthStores for more details on available options for your authentication store. I've done rather extensive updates lately to ensure it's holding most relevant information.
Don't dare to ask for more without a single line of your configuration (trac.ini). How should we answer, if you just copy the error, but don't tell us anything about your setup?