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

wfrog does not work with python 2.7 (workaround implemented) #85

Closed
GoogleCodeExporter opened this issue Jul 14, 2015 · 22 comments
Closed

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Try to start either wflogger or wfrender with scripts in /etc/init.d/
2. Nothing happens. Nothing is shown in the log files
3. Manual call of ".../wfrog -- --backend -m" gives errors.

What is the expected output? What do you see instead?
Expecting to see normal entries in log files from application startup. Instead 
nothing is logged and processes are not started.

What version of the product are you using? On what operating system?
- wfrog version 0.8.1 build 797
- Ubuntu Linux 11.04 server edition
- Python version 2.7.1+

Please provide any additional information below.
Application worked without any problems with Ubuntu 10.10. Problem started 
after the upgrade.

Here's the case:
root@orchid:~# /etc/init.d/wflogger start
Starting /usr/lib/wfrog/bin/wfrog...
Detaching to start /usr/lib/wfrog/bin/wfrog...done.
root@orchid:~# echo $?
0
root@orchid:~# ps -ef|grep -i wf|grep -v grep
root@orchid:~#

Command line test gives the following error:
root@orchid:~# /usr/lib/wfrog/bin/wfrog -- --backend -m
Traceback (most recent call last):
  File "/usr/lib/wfrog/bin/wfrog", line 138, in <module>
    component.run(config_file, settings)
  File "/usr/lib/wfrog/wflogger/wflogger.py", line 132, in run
    self.configure(config_file, settings_file)
  File "/usr/lib/wfrog/wflogger/wflogger.py", line 94, in configure
    (config, self.context) = self.configurer.configure(options, self, config_file, settings_file)
  File "/usr/lib/wfrog/wfcommon/config.py", line 123, in configure
    self.logger.info("Starting wfrog " + wfrog_version)
  File "/usr/lib/python2.7/logging/__init__.py", line 1132, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1250, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 740, in handle
    rv = self.filter(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 603, in filter
    for f in self.filters:
AttributeError: 'RotatingFileHandler' object has no attribute 'filters'
root@orchid:~#

Additionally command line Wunderground test returns:
root@orchid:/etc/wfrog/wfrender/config# python 
/usr/lib/wfrog/wfrender/wfrender.py -f wunderground.yaml -s ../../settings.yaml
Traceback (most recent call last):
  File "/usr/lib/wfrog/wfrender/wfrender.py", line 131, in <module>
    result = engine.process("config/wfrender.yaml", embedded=False)
  File "/usr/lib/wfrog/wfrender/wfrender.py", line 96, in process
    self.configure(embedded)
  File "/usr/lib/wfrog/wfrender/wfrender.py", line 86, in configure
    self.reconfigure(options, args, embedded)
  File "/usr/lib/wfrog/wfrender/wfrender.py", line 90, in reconfigure
    self.configurer.configure_engine(self,options, args, embedded, self.config_file, self.settings_file)
  File "/usr/lib/wfrog/wfrender/config.py", line 70, in configure_engine
    (config, config_context) = self.configure(options, engine, config_file, settings_file, embedded=embedded)
  File "/usr/lib/wfrog/wfcommon/config.py", line 123, in configure
    self.logger.info("Starting wfrog " + wfrog_version)
  File "/usr/lib/python2.7/logging/__init__.py", line 1132, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1250, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1260, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1300, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 740, in handle
    rv = self.filter(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 603, in filter
    for f in self.filters:
AttributeError: 'RotatingFileHandler' object has no attribute 'filters'
root@orchid:/etc/wfrog/wfrender/config#

This latter test provably has worked before. See Issue 81.

Seems like Ubuntu has updated python from previous 2.6.6 to 2.7.1 in 11.04. If 
that helps.

Please advice.

Original issue reported on code.google.com by sami.til...@gmail.com on 8 May 2011 at 7:38

@GoogleCodeExporter
Copy link
Author

It appears that wfrog does not support yet python 2.7. In the meantime, you 
will have to install python 2.6 alongside

Original comment by laurent....@gmail.com on 8 May 2011 at 9:45

@GoogleCodeExporter
Copy link
Author

Confirmed.
Here's the workaround for the time being.

1) Install python 2.6
$ sudo apt-get install python2.6
2) Change the default python to 2.6
$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root       9 2011-04-28 21:18 /usr/bin/python -> python2.7
-rwxr-xr-x 1 root root 2333224 2011-03-25 21:32 /usr/bin/python2.6
-rwxr-xr-x 1 root root 2375356 2011-04-11 22:14 /usr/bin/python2.7
$ sudo rm /usr/bin/python
$ sudo ln -s /usr/bin/python2.6 /usr/bin/python
$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root      18 2011-05-09 11:11 /usr/bin/python -> 
/usr/bin/python2.6
-rwxr-xr-x 1 root root 2333224 2011-03-25 21:32 /usr/bin/python2.6
-rwxr-xr-x 1 root root 2375356 2011-04-11 22:14 /usr/bin/python2.7
$

After these steps all work as before.

Note, that this makes a system-wide change. If python2.7 is required somewhere, 
it probably brakes after this change.

Thanks for the help.

Original comment by sami.til...@gmail.com on 9 May 2011 at 8:27

@GoogleCodeExporter
Copy link
Author

Original comment by laurent....@gmail.com on 6 Jun 2011 at 8:15

  • Changed state: Accepted
  • Added labels: Milestone-Release1.0

@GoogleCodeExporter
Copy link
Author

The workaround works indeed, but on ubuntu 11.04 it will instead break the 
Ubuntu Update Manager (which needs link to python2.7).

Original comment by pk2...@gmail.com on 7 Jun 2011 at 3:40

@GoogleCodeExporter
Copy link
Author

Hi, 
my solution Elecsa Astrotouch 6975 ubuntu 11.10 x86_64 3.0.0-12-generic

get pywws
test if pywws Test station py works (if not, comment the check magic number in 
pywws/WeatherStation.py)
sudo python2.6 setup.py install
install wfrog deb package
edit /usr/bin/wfrog to use python2.6 (first line) instead of python

seems to work
thx

Original comment by kun...@post.sk on 15 Nov 2011 at 10:25

@GoogleCodeExporter
Copy link
Author

Hi,
This issue got worse with Ubuntu 12.04, since python2.6 package is not included 
in the distribution any more and wfrog still does not support python2.7 or 
python3, which now are available.
I have yet to find a workaround.

I you encourage to prioritize this issue.

Original comment by sami.til...@gmail.com on 29 Apr 2012 at 8:21

@GoogleCodeExporter
Copy link
Author

Original comment by jordi.pu...@gmail.com on 18 Jul 2012 at 7:42

  • Changed title: wfrog does not work with python 2.7
  • Added labels: Priority-High
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

Issue 114 has been merged into this issue.

Original comment by jordi.pu...@gmail.com on 18 Jul 2012 at 7:43

@GoogleCodeExporter
Copy link
Author

Found this guide to install python 2.6 on ubuntu 12.04
https://singhgurjot.wordpress.com/2012/07/10/how-to-install-python-2-6-in-ubuntu
-12-04/

Original comment by gvoulg...@gmail.com on 9 Aug 2012 at 4:34

@GoogleCodeExporter
Copy link
Author

The problem is due to a problem recovetin

Original comment by jordi.pu...@gmail.com on 10 Aug 2012 at 11:25

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

I've found a workaround for this issue. 

In the file ./wfrog-0.8.2/wfcommon/config/fileloghandler.yaml

If you comment out the RotatingFileHandler declaration and replace it with a 
NullHandler declaration you should be able to get wfrog to start.

Post change, the file should appear as follows:

#handler: !!python/object/new:logging.handlers.RotatingFileHandler
handler: !!python/object/new:logging.NullHandler
    kwds:
        filename: ${filename}
        maxBytes: 262144
        backupCount: 3

This obviously has ramifications for the way wfrog does logging, but it should 
at least get you running on Python 2.7.3.

Original comment by quigle...@gmail.com on 10 Aug 2012 at 1:39

@GoogleCodeExporter
Copy link
Author

The problem is related with the way yaml instantiates the objects. For some 
reason it is not doing it the right way on python 2.7. I've created an issue in 
python to check for this problem: http://bugs.python.org/issue15616

Original comment by jordi.pu...@gmail.com on 10 Aug 2012 at 1:45

@GoogleCodeExporter
Copy link
Author

From python 2.6 to python 2.7 logging classes switched from old style to new 
style classes. This change could have triggered this issue. I've created an 
issue in PyYaml (http://pyyaml.org/ticket/283).

Original comment by jordi.pu...@gmail.com on 11 Aug 2012 at 2:32

@GoogleCodeExporter
Copy link
Author

Since it is not clear how can be solved the problem instantiating
handlers via yaml I've implemented a workaround: wfrog uses by
default a RotatingFileHandler without using yaml. 

We assume that this fits the needs of most users and allow wfrog
to run out of the box in all versions of python. When a solution is
found for yaml we will reverse the workaround.

I leave the issue open, waiting for final solution

Original comment by jordi.pu...@gmail.com on 12 Aug 2012 at 8:33

  • Changed title: wfrog does not work with python 2.7 (workaround implemented)

@GoogleCodeExporter
Copy link
Author

Hi, I think I've just struck this issue and was wondering if there's any 
updates about a permanent fix?

Original comment by YottaM...@gmail.com on 25 Jan 2013 at 9:24

@GoogleCodeExporter
Copy link
Author

The pyyaml ticket is still open ... just use the latest svn version and that 
should solve the problem. We ought to create a new version of wfrog with these 
changes!!

Original comment by jordi.pu...@gmail.com on 26 Jan 2013 at 8:58

@GoogleCodeExporter
Copy link
Author

Its been a while since I've had a chance to attack this problem again...

First time around I used the workaround proposed by Quigle which got wfrog to 
load, however I could never get the dashboard to load, it constantly threw 500 
(Internal Server) errors. However I think that was a separate issue due to 
trying a custom configuration (I need an external database because I have extra 
sensors)

Second time around I installed the base .deb package, then downloaded the 
latest svn build and overwrote the wfcommon, wflogger, wfrenderer and wfdriver 
folders with the svn folders. Probably not the "correct" way to install them, 
but it appears to work, I have my dashboard... Now to break it trying for a 
customisation...

Original comment by YottaM...@gmail.com on 24 Mar 2013 at 9:40

@GoogleCodeExporter
Copy link
Author

I have an alternative workaround which worked for me on Ubuntu 12.04 with 
python 2.7:

In the file wfcommon/config/fileloghandler.yaml, change 'new' to 'apply' in the 
line

  handler: !!python/object/new:logging.handlers.RotatingFileHandler

so you end up with:

handler: !!python/object/apply:logging.handlers.RotatingFileHandler
    kwds:
        filename: ${filename}
        maxBytes: 262144
        backupCount: 3


This *should* work with earlier versions of python too, but I haven't tested it.

Original comment by andy.cla...@gmail.com on 5 Apr 2013 at 6:32

@GoogleCodeExporter
Copy link
Author

Andy's workaround worked also for me, Ubuntu 13.04 and wfrog 0.8.2. Required no 
other tweek, installed wfrog, ran wfrog, activated simulation settings and 
started wfrog. Without the tweek I got the same error as mentioned above, after 
having entered all simulation settings.

Original comment by karljoha...@gmail.com on 8 Aug 2013 at 11:02

@GoogleCodeExporter
Copy link
Author

Andy's workaround works also for me ! Ubtuntu_13.04 and wfrog_0.8.2 configured 
as " random-simulator ".

Original comment by tiouck.p...@gmail.com on 8 Aug 2013 at 5:03

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Andy workaround eventually worked for me after clean ubuntu server 14.04 
installation

but to be able to access my WR200 station I had to load module usbhid 

Original comment by Phane.Ph...@gmail.com on 7 Jun 2015 at 8:11

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

No branches or pull requests

2 participants