[Tutor] How to change default path output of 'logging'?

2014-12-22 Thread Juan Christian
I have a 'logging' on my code using:

import logging
< ... >
logging.basicConfig(filename="bumpr.log", level=logging.INFO)
< ... >

The thing is that the default location of this output when running via
Windows Task Scheduler is 'C:/Windows/System32'.

Is there a way to change the location of the output of this module? I want
it to output where my 'main.py' is.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] How to change default path output of 'logging'?

2014-12-22 Thread Zachary Ware
On Monday, December 22, 2014, Juan Christian > wrote:

> I have a 'logging' on my code using:
>
> import logging
> < ... >
> logging.basicConfig(filename="bumpr.log", level=logging.INFO)
> < ... >
>
> The thing is that the default location of this output when running via
> Windows Task Scheduler is 'C:/Windows/System32'.
>
> Is there a way to change the location of the output of this module? I want
> it to output where my 'main.py' is.
>

That location is not a function of logging, it's a function of running via
Windows Task Scheduler, which apparently starts the program with a current
directory of C:\Windows\System32. The solution is to give logging an
absolute path for the output file (which you can base of off __file__,
something like """os.path.join(os.path.dirname(__file__), "bumpr.log")""") .

Hope this helps,
--
Zach


-- 
Sent from Gmail Mobile
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to change default path output of 'logging'?

2014-12-22 Thread Dave Angel

On 12/22/2014 07:53 AM, Juan Christian wrote:

I have a 'logging' on my code using:

import logging
< ... >
logging.basicConfig(filename="bumpr.log", level=logging.INFO)
< ... >

The thing is that the default location of this output when running via
Windows Task Scheduler is 'C:/Windows/System32'.


You want it in a different file, specify a different file.  For example,

logging.basicConfig(filename="F:/data/logging_info/bumpr.log", 
level=logging.INFO)




Is there a way to change the location of the output of this module? I want
it to output where my 'main.py' is.


No idea what part main.py plays to your code.  If it's imported, then 
you could use main.__file__  to get the full pathname to it.  Then use 
os.path.dirname() to get the directory.  Then use os.path.join() to 
combine that with "bumpr.log".


More likely, this is your script.  So if you're trying to get the 
filename from the script, you just use

  __file__

And if that doesn't show up as an absolute path, use os.path.abspath.  i 
couldn't test that part, since I don't use Windows, and can't play with 
the Windows Task Scheduler.




--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to change default path output of 'logging'?

2014-12-22 Thread Juan Christian
On Mon Dec 22 2014 at 1:35:44 PM Dave Angel  wrote:
>
> No idea what part main.py plays to your code.  If it's imported, then
> you could use main.__file__  to get the full pathname to it.  Then use
> os.path.dirname() to get the directory.  Then use os.path.join() to
> combine that with "bumpr.log".
>
> More likely, this is your script.  So if you're trying to get the
> filename from the script, you just use
>__file__
>
> And if that doesn't show up as an absolute path, use os.path.abspath.  i
> couldn't test that part, since I don't use Windows, and can't play with
> the Windows Task Scheduler.
>

Thanks guys, it worked like a charm.

str(os.path.abspath(__file__)).replace('main.py', '')

So I get the full-path of my main dir where main.py is and all the other
modules/packages too, no matter if I'm on OSX/Win/Linux.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to change default path output of 'logging'?

2014-12-22 Thread Dave Angel

On 12/22/2014 11:41 AM, Juan Christian wrote:



str(os.path.abspath(__file__)).replace('main.py', '')

So I get the full-path of my main dir where main.py is and all the other
modules/packages too, no matter if I'm on OSX/Win/Linux.


That's not the best way to get the directory path for a file.  You 
should use  os.path.dirname().  That way if the basename changes from 
main.py to something else (like main.pyc, or main.pyw, or 
usefulcode.py), it'll still work.  It fixes other problems also, that 
are less likely to occur.


os.path.dirname(os.path.abspath(__file__))  should do it for you.  And 
that means that you want something like:


filename=os.path.join(os.path.dirname(os.path.abspath(__file__)), 
"bumpr.log")


(untested)


--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-22 Thread Vishwas Pathak
Hi,

I am working building on developing an automation framework for my product . I 
need to implement multi-threading having a pool of thread where each thread 
will be executed different set of test cases on remote windows machines. 
Consider following example  -

Say I have two windows OS test machines and I want to execute test cases number 
1 to 5 on test machine 1 and test cases number 6 to 10 on test machine 2. I 
will create a thread pool of 2 threads and thread 1 will connect to test 
machine 1 and execute the test cases 1 to 5 and thread 2 will connect to test 
machine 2 and execute the test cases 6 to 10. Also each thread will generate 
the log files separately printing execution details for respective test machine 
which is assigned to this particular thread.

Please provide your inputs in designing this mechanism.

Many Thanks !!

Regards,
Vishwas Pathak


DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-22 Thread Danny Yoo
On Dec 22, 2014 10:57 AM, "Vishwas Pathak" 
wrote:
>
> Hi,
>
> I am working building on developing an automation framework for my
product . I need to implement multi-threading having a pool of thread where
each thread will be executed different set of test cases on remote windows
machines.

Apologies, but this question is definitely out of bounds for Python-tutor.
This mailing list is for beginners who are learning basic programming: your
question would be more suited to an advanced forum, such as the main Python
list. Try asking there instead.

Good luck.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-22 Thread wolfrage8...@gmail.com
On Mon, Dec 22, 2014 at 6:27 AM, Vishwas Pathak <
vishwas_pat...@persistent.com> wrote:
Your Disclaimer alone means that I can not respond to this question, or
else it would apparently become the property of Persistent Systems Ltd. I
prefer Open Source to closed source... good day.

>
>
> DISCLAIMER
> ==
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-22 Thread Alex Kleider

On Dec 22, 2014 12:36 PM, wolfrage8...@gmail.com wrote:
>
> On Mon, Dec 22, 2014 at 6:27 AM, Vishwas Pathak < 
> vishwas_pat...@persistent.com> wrote: 
> Your Disclaimer alone means that I can not respond to this question, or 
> else it would apparently become the property of Persistent Systems Ltd. I 
> prefer Open Source to closed source... good day. 
>

Although I also find the disclaimer somewhat obnoxious and also prefer open 
source, I think you are mistaken in your conclusion about exactly what the 
disclaimer says.

> > 
> > 
> > DISCLAIMER 
> > == 
> > This e-mail may contain privileged and confidential information which is 
> > the property of Persistent Systems Ltd. It is intended only for the use of 
> > the individual or entity to which it is addressed. If you are not the 
> > intended recipient, you are not authorized to read, retain, copy, print, 
> > distribute or use this message. If you have received this communication in 
> > error, please notify the sender and delete all copies of this message. 
> > Persistent Systems Ltd. does not accept any liability for virus infected 
> > mails. 
> > 
> > ___ 
> > Tutor maillist  -  Tutor@python.org 
> > To unsubscribe or change subscription options: 
> > https://mail.python.org/mailman/listinfo/tutor 
> > 
> ___ 
> Tutor maillist  -  Tutor@python.org 
> To unsubscribe or change subscription options: 
> https://mail.python.org/mailman/listinfo/tutor 
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-22 Thread Dave Angel

On 12/22/2014 09:58 PM, Alex Kleider wrote:


On Dec 22, 2014 12:36 PM, wolfrage8...@gmail.com wrote:


On Mon, Dec 22, 2014 at 6:27 AM, Vishwas Pathak <
vishwas_pat...@persistent.com> wrote:
Your Disclaimer alone means that I can not respond to this question, or
else it would apparently become the property of Persistent Systems Ltd. I
prefer Open Source to closed source... good day.



Although I also find the disclaimer somewhat obnoxious and also prefer open 
source, I think you are mistaken in your conclusion about exactly what the 
disclaimer says.



You're right that he's mistaken.  it's even worse.  The disclaimer 
claims I'm not permitted to read such messages, nor save them on my 
machine.  So I'm considering writing a filter to try to comply by 
deleting them before they accidentally come before my eyes.




--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-22 Thread wolfrage8...@gmail.com
On Mon, Dec 22, 2014 at 10:21 PM, Dave Angel  wrote:

> On 12/22/2014 09:58 PM, Alex Kleider wrote:
>
>>
>> On Dec 22, 2014 12:36 PM, wolfrage8...@gmail.com wrote:
>>
>>>
>>> On Mon, Dec 22, 2014 at 6:27 AM, Vishwas Pathak <
>>> vishwas_pat...@persistent.com> wrote:
>>> Your Disclaimer alone means that I can not respond to this question, or
>>> else it would apparently become the property of Persistent Systems Ltd. I
>>> prefer Open Source to closed source... good day.
>>>
>>>
>> Although I also find the disclaimer somewhat obnoxious and also prefer
>> open source, I think you are mistaken in your conclusion about exactly what
>> the disclaimer says.
>>
>>
> You're right that he's mistaken.  it's even worse.  The disclaimer claims
> I'm not permitted to read such messages, nor save them on my machine.  So
> I'm considering writing a filter to try to comply by deleting them before
> they accidentally come before my eyes.
>
> I had sent this just to Alex, but since reading your reply (Dave) I
figured I should just post it too.
Sent to Alex: You are completely correct. I more so felt like the OP wanted
us to help him with something that is clearly at a business level with the
expectation that it would disappear into his company. But then again I am
placing words into his mouth which clearly were not said. Although who is
the authorized party to read and retain his emails, it seems ambiguous when
he is sending it to a public mailing list?
Sorry for over generalizing and being overly sarcastic.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor