Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-24 Thread RaiMan
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

RaiMan posted a new comment:
@ Jason
I checked the situation again with the script you sent me.

--1. script naming
A script should not be named like a module, that you are importing in the 
script itself. This collides with Sikuli's support for importing other Sikuli 
scripts.
So I first had to rename the script to something else than Logging.sikuli, to 
get the import logging to work at all.
You have to do this too.

--2. ValueError: I/O operation on closed file
This error happens in the __init__.py module of the logging module, when import 
is processed. There seems to be some bug.
Using the following sequence instead of the simple import, solves the problem:

# once at beginning of script
import logging 
reload(logging)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-24 Thread RaiMan
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

RaiMan posted a new comment:
@ Jason

The log file extension .log seems to collide with Sikuli's import feature and 
Sikuli's internal use of the logging feature.
You might get Sikuli messages into your log file.

I found that naming the log files with an extension .txt avoids this
problem situation.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-14 Thread RaiMan
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

RaiMan posted a new comment:
--- Python version in my Mac Lion is 2.7.1
@ Jason

Python has nothing to do with Sikuli. All modules that are needed by the
Jython interpreter, that comes bundled with Sikuli, are taken from from
within the normal Sikuli installation.

With a few exceptions (modules written in pure Python) standard C-Python
modules cannot be used with Jython/Sikuli. Furthermore Sikuli's Jython
(as Jython generally in the moment) is on Python language level 2.5.

--- I also see this error after playing with above script for awhile
Not sure what you mean by that: running it over and over again or making 
changes/additions.
This kind of import error usually happens, if the module (logging in this case) 
cannot be found on sys.path (did you make any changes to that?) or if a folder 
logging.sikuli can be found by Sikuli's import feature, that is invalid. 

--- ValueError: I/O operation on closed file
What is done on this line 750? 
The error message tells, that logging.__init__ is run. This should only happen 
once at the beginning of a script. Do not place more than one import logging 
statement in your script.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-14 Thread RaiMan
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

RaiMan posted a new comment:
@Jason

Sorry, the last topic was rubbish ;-)

--- ValueError: I/O operation on closed file
What is done on the line in the script, that caused the error?
The error message tells, that logging.__init__ is run. This should only happen 
once at the beginning of a script. Do not place more than one import logging 
statement in your script.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-13 Thread Jason D Tran
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

Jason D Tran posted a new comment:
Thanks so much for helping, RaiMan!

Trying your suggested script: It works, but I got this error:

Traceback (most recent call last):
 File 
/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/logging/__init__.py,
 line 750, in emit
 File 
/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/logging/__init__.py,
 line 750, in emit
ValueError: I/O operation on closed file



I also see this error after playing with above script for awhile (Python
version in my Mac Lion is 2.7.1):

Traceback (most recent call last):
 File 
/var/folders/__/xmjv8nnd0rd6bqvrpbggrfd8gn/T/sikuli-tmp7724115150528538567.py,
 line 1, in 
 import logging
 File 
/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/sikuli/SikuliImporter.py,
 line 45, in load_module
 File 
/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/sikuli/SikuliImporter.py,
 line 25, in _load_module
ImportError: No module named logging

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-06 Thread Steen
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

Steen posted a new comment:
@Jason
yes it appends.

i have made this:
to start:
import logging
import os

#show all levels (INFO, WARNING, ERROR)
logger.setLevel(logging.INFO)

the use in the script:
logger.info('your pants are going to burn')
logger.warning('your pants are soaked in petrol')
logger.error('you are now burning')

at the end of script:
logger.removeHandler(hdlr)
logging.shutdown

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2012-01-05 Thread Jason D Tran
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

Jason D Tran posted a new comment:
When you specify:

logging.basicConfig(filename=C:\\Users\\user\\Desktop\\Iconlogfile.log,
level=logging.INFO)

Is it in append mode already? (File will be created if it's not exist,
and new info will be appended at the end if it's already exist)

Also, how would you open and close file for logging?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2011-11-29 Thread RaiMan
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

RaiMan proposed the following answer:
 all you need is in the 2 comments above

here you are:

logging.info(%s %s%(time.strftime(%H:%M:%S), 'device picked and
ready for test'))

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2011-11-29 Thread Steen
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

Steen posted a new comment:
fantastiskTHX

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #180346]: Timestamp in logfile

2011-11-28 Thread Steen
New question #180346 on Sikuli:
https://answers.launchpad.net/sikuli/+question/180346

import logging
logging.__init__(0)
logging.basicConfig(filename=C:\\Users\\user\\Desktop\\Iconlogfile.log, 
level=logging.INFO)

and then use:
logging.info('device picked and ready for test')
everytime i have to print to log file.

everything works!great...:0)

But i need timestamp of every post
so instead of:
INFO:root:DB8 MKII picked and ready for test
INFO:root:software found

i would like:
11:10:10:DB8 MKII picked and ready for test
11.10.20:software found

and so on?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #180346]: Timestamp in logfile

2011-11-28 Thread Steen
Question #180346 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180346

Steen posted a new comment:
could you do an example of my code?

been looking on that at python but cant make it work.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp