Open praveingk opened 8 years ago
Hi Pravein!
I'm afraid this is a serious case of code rotting (printing is not the most used feature...)
I don't have time to properly fix and test it now, but if you feel comfortable editing code, can you try changing the lines in https://github.com/cms-dev/cms/blob/master/cms/server/contest/handlers/main.py#L334 to:
printjob = PrintJob(timestamp=self.timestamp,
participation=participation,
filename=filename,
digest=digest)
(just the second line changes)
Hi Stefano,
Did the change and built it. Again, its giving the same error :
2016-03-16 18:39:56,804 - ERROR [Contest,0] Uncaught exception
(TypeError(u"PrintJob.init() got an unexpected keyword argument
'user'",)) while processing a request: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1346,
in _execute
result = method(_self.path_args, _self.path_kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 2626,
in wrapper
return method(self, _args, _kwargs)
File
"/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/util.py",
line 196, in wrapped
return func(self, _args, _kwargs)
File
"/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py",
line 337, in post
digest=digest)
File "
Probably there are multiple usage instances. I verified the updated code in "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py",
Thanks, Pravein.
On Wed, Mar 16, 2016 at 6:15 PM, Stefano Maggiolo notifications@github.com wrote:
Hi Pravein!
I'm afraid this is a serious case of code rotting (printing is not the most used feature...)
I don't have time to properly fix and test it now, but if you feel comfortable editing code, can you try changing the lines in https://github.com/cms-dev/cms/blob/master/cms/server/contest/handlers/main.py#L334 to:
printjob = PrintJob(timestamp=self.timestamp, participation=participation, filename=filename, digest=digest)
(just the second line changes)
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cms-dev/cms/issues/587#issuecomment-197247581
That's the same line, so you must be missing something. You can try remove entirely /usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg and reinstall, or maybe start by removing "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.pyc (sometimes I had problems that python was actually executing a stale .pyc)
Hi Stefano,
I removed the entire cms-1.3.dev0-py2.7.egg directory, and installed again with the changes. Still I face the same error.
Thanks, Pravein.
On Wed, Mar 16, 2016 at 6:57 PM, Stefano Maggiolo notifications@github.com wrote:
That's the same line, so you must be missing something. You can try remove entirely /usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg and reinstall, or maybe start by removing "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.pyc (sometimes I had problems that python was actually executing a stale .pyc)
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cms-dev/cms/issues/587#issuecomment-197260778
Are you sure it's the same error? Can you paste it just to be sure?
If it's really the same error, then CMS was not reinstalled.
I noticed that in the 2 errors you pasted there are different paths for the same files, e.g.:
/home/sadm/.local/lib/python2.7/site-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py
and in the next error:
/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py
The best thing to do is probably to use virtual environments. However, to uninstall CMS you can try:
$ pip uninstall --user cms && sudo pip uninstall cms
And then, before reinstalling it:
$ rm -rf build/ dist/ cms.egg-info/
Hi William,
The errors had different paths, because I had used two different machines just to check the behaviour. Sorry.
The error that I got now, after removing and installing again is below :
2016-03-16 21:51:50,386 - ERROR [Contest,0] Uncaught exception
(TypeError(u"PrintJob.init() got an unexpected keyword argument
'user'",)) while processing a request: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1346,
in _execute
result = method(_self.path_args, _self.path_kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 2626,
in wrapper
return method(self, _args, _kwargs)
File
"/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/util.py",
line 196, in wrapped
return func(self, _args, _kwargs)
File
"/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py",
line 337, in post
digest=digest)
File "
Thanks, Pravein.
On Wed, Mar 16, 2016 at 9:37 PM, William Di Luigi notifications@github.com wrote:
Are you sure it's the same error? Can you paste it just to be sure?
If it's really the same error, then CMS was not reinstalled.
I noticed that in the 2 errors you pasted there are different paths for the same files, e.g.:
/home/sadm/.local/lib/python2.7/site-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py
and in the next error:
/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py
The best thing to do is probably to use virtual environments. However, to uninstall CMS you can try:
$ pip uninstall --user cms && sudo pip uninstall cms
And then, before reinstalling it:
$ rm -rf build/ dist/ cms.egg-info/
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cms-dev/cms/issues/587#issuecomment-197334038
That's again the same issue indeed, that should be covered by the change you made... not sure what to suggest more apart from going over the same steps of before (deleting the .pyc, checking that the content is indeed the right one)
You could try re-installing inside a virtual environment. Follow these instructions.
Hi Stefano/William,
Thanks a lot for your help. I am past the earlier error now, and now stuck with another error as below :
2016-03-16 22:32:19,943 - ERROR [Printing,0] Unexpected error when executing operation `printing job 1'. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/io/triggeredservice.py", line 149, in run self.execute(to_execute[0]) File "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/service/PrintingService.py", line 95, in execute contest = user.contest AttributeError: 'User' object has no attribute 'contest'
Kindly let me know what needs to be changed . Should i remove the user keyword here too?
Thanks, Pravein.
On Wed, Mar 16, 2016 at 10:13 PM, William Di Luigi <notifications@github.com
wrote:
You could try re-installing inside a virtual environment. Follow these instructions http://cms.readthedocs.org/en/latest/Installation.html#virtual-environment .
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cms-dev/cms/issues/587#issuecomment-197349864
Change line 95 in cms/service/PrintingService.py from:
contest = user.contest
to:
contest = printjob.participation.contest
Hi William,
Yes, I had changed similar way, and hit another roadblock :
2016-03-16 23:17:42,379 - ERROR [Printing,0] Unexpected error when executing operation `printing job 2'. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/io/triggeredservice.py", line 149, in run self.execute(to_execute[0]) File "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/service/PrintingService.py", line 136, in execute ret = subprocess.call(cmd, cwd=directory) File "/usr/lib/python2.7/subprocess.py", line 522, in call return Popen(_popenargs, *_kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
Can you please help. Sorry about the emails back and forth.
Thanks, Pravein.
On Wed, Mar 16, 2016 at 11:08 PM, William Di Luigi <notifications@github.com
wrote:
Change line 95 in cms/service/PrintingService.py from:
contest = user.contest
to:
contest = printjob.participation.contest
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cms-dev/cms/issues/587#issuecomment-197374567
Sorry for the trouble. I installed a2ps, and it seems to be working.
Thanks a lot William/Stefano for the help :)
Regards, Pravein.
On Wed, Mar 16, 2016 at 11:19 PM, Pravein GK praveingk@gmail.com wrote:
Hi William,
Yes, I had changed similar way, and hit another roadblock :
2016-03-16 23:17:42,379 - ERROR [Printing,0] Unexpected error when executing operation `printing job 2'. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/io/triggeredservice.py", line 149, in run self.execute(to_execute[0]) File "/usr/local/lib/python2.7/dist-packages/cms-1.3.dev0-py2.7.egg/cms/service/PrintingService.py", line 136, in execute ret = subprocess.call(cmd, cwd=directory) File "/usr/lib/python2.7/subprocess.py", line 522, in call return Popen(_popenargs, *_kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
Can you please help. Sorry about the emails back and forth.
Thanks, Pravein.
On Wed, Mar 16, 2016 at 11:08 PM, William Di Luigi < notifications@github.com> wrote:
Change line 95 in cms/service/PrintingService.py from:
contest = user.contest
to:
contest = printjob.participation.contest
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cms-dev/cms/issues/587#issuecomment-197374567
I had configured printer for the Contest, and also tested it using lpr/lpstat.
However, When a user submits the printing job, the below exception is thrown. Can you kindly let me know the way to fix it?
2016-03-16 17:54:48,747 - ERROR [Contest,0] Uncaught exception (TypeError(u"PrintJob.init() got an unexpected keyword argument 'user'",)) while processing a request: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1346, in _execute result = method(_self.path_args, _self.path_kwargs) File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 2626, in wrapper return method(self, _args, _kwargs) File "/home/sadm/.local/lib/python2.7/site-packages/cms-1.3.dev0-py2.7.egg/cms/server/util.py", line 196, in wrapped return func(self, _args, _kwargs) File "/home/sadm/.local/lib/python2.7/site-packages/cms-1.3.dev0-py2.7.egg/cms/server/contest/handlers/main.py", line 337, in post digest=digest) File "", line 4, in init
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/state.py", line 306, in _initialize_instance
manager.dispatch.init_failure(self, args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 60, in exit
compat.reraise(exc_type, exc_value, exc_tb)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/state.py", line 303, in _initialize_instance
return manager.original_init(_mixed[1:], _kwargs)
File "/home/sadm/.local/lib/python2.7/site-packages/cms-1.3.dev0-py2.7.egg/cms/db/base.py", line 230, in init
(cls.name, kwargs.popitem()[0]))
TypeError: PrintJob.init() got an unexpected keyword argument 'user'