Begginers problem : tar: Error opening archive: Can't initialize filter; unable to run program "bzip2 -d

2018-12-29 Thread Rand .J
Hello everyone

I'm completely new to python and I'm facing this problem :

I'm trying to run this code from : https://github.com/pnnl/*safekit* ,using
cmd on windows 10, I already installed python. when I type the command: tar
-xjvf data_examples.tar.bz2

I keep getting the error: tar: Error opening archive: Can't initialize
filter; unable to run program "bzip2 -d"

I have tried to download bzip2 through easy-7 zip and GnuWin32 , but it
didn't work. Can any one help me? Thank you

P.S.: this might not be a Python specific problem, but I searched for the
same problem before posting mine.


I apologize for any inconvenience

Thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Passing back the ERRORLEVEL

2018-12-29 Thread eryk sun
On 12/28/18, Gisle Vanem  wrote:
> I have trouble understanding why a 'sys.exit(2)' is
> *not* passed back to the CMD shell in this little example:
>
> - c:\py_cmd_test.cmd --
> @%WinDir%\py.exe -2 -x %~dp0py_cmd_test.cmd & exit /b %ERRORLEVEL%

%ERRORLEVEL% gets expanded in the initial parsing before this line is
executed, at which time it is 0. Because of the /b argument, you're
not actually exiting CMD and have no reason to change the error value.
Just use `exit /b`.

Why use CMD as a launcher when you have py.exe with shebang support?
-- 
https://mail.python.org/mailman/listinfo/python-list


Monte Carlo Quant: Opensource project

2018-12-29 Thread bhagvanarch
Quantica computacao has started an open source initiative in python. We invite 
students and professionals to be part of it . My email address is 
[email protected] or [email protected]

Repository link is : https://github.com/bhagvank/Montecarlo_Quant
If you want to participate and get invitation, please share the github ids.



A slack channel for monte carlo open source:

https://goo.gl/iM29fH

Telegram Group for Monte Carlo Open source:

https://t.me/joinchat/KisuQBYtJbinYm5tBytOTw
-- 
https://mail.python.org/mailman/listinfo/python-list


Logging - have logger use caller's function name and line number

2018-12-29 Thread Malcolm Greene
I have a class method that adds additional context to many of the
class's log messages. Rather than calling, for example,  logger.info(
'message ...' ) I would like to call my_object.log( 'message ...' ) so
that this additional context is managed in a single place. I'm actually
doing that and its working great except that ... as expected ... all my
log records have the my_object.log method's name and line numbers vs the
callers' names and line numbers.
Is there a technique I can use to have my custom log method inject the
caller's name and line numbers in the log output?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Logging - have logger use caller's function name and line number

2018-12-29 Thread Peter Otten
Malcolm Greene wrote:

> I have a class method that adds additional context to many of the
> class's log messages. Rather than calling, for example,  logger.info(
> 'message ...' ) I would like to call my_object.log( 'message ...' ) so
> that this additional context is managed in a single place. I'm actually
> doing that and its working great except that ... as expected ... all my
> log records have the my_object.log method's name and line numbers vs the
> callers' names and line numbers.
> Is there a technique I can use to have my custom log method inject the
> caller's name and line numbers in the log output?

https://mail.python.org/pipermail/python-list/2010-March/570941.html

No idea if this works with current Python, or if there is a more elegant way 
by now.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Logging - have logger use caller's function name and line number

2018-12-29 Thread David
On Sun, 30 Dec 2018 at 05:58, Malcolm Greene  wrote:
>
> I have a class method that adds additional context to many of the
> class's log messages. Rather than calling, for example,  logger.info(
> 'message ...' ) I would like to call my_object.log( 'message ...' ) so
> that this additional context is managed in a single place. I'm actually
> doing that and its working great except that ... as expected ... all my
> log records have the my_object.log method's name and line numbers vs the
> callers' names and line numbers.
> Is there a technique I can use to have my custom log method inject the
> caller's name and line numbers in the log output?

You can use this:
https://docs.python.org/3/library/inspect.html#the-interpreter-stack
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Begginers problem : tar: Error opening archive: Can't initialize filter; unable to run program "bzip2 -d

2018-12-29 Thread Cameron Simpson

On 29Dec2018 11:15, Rand .J  wrote:
I'm trying to run this code from : https://github.com/pnnl/*safekit* 
,using cmd on windows 10, I already installed python. when I type the command: tar

-xjvf data_examples.tar.bz2

I keep getting the error: tar: Error opening archive: Can't initialize
filter; unable to run program "bzip2 -d"

I have tried to download bzip2 through easy-7 zip and GnuWin32 , but it
didn't work. Can any one help me? Thank you

P.S.: this might not be a Python specific problem, but I searched for the
same problem before posting mine.


This isn't a Python issue: you're not even running Python.

GNU tar's decompress modes work by invoking an external programme to do 
the decompression. For the -j option, that programme is "bzip2 -d".


Where did you get tar from? Can you get bzip2 from the same place?  
Note: bzip2 is NOT related to the "zip" programme.


Personally, when I need to use Windows I like to install Cygwin:

 https://cygwin.com/

and pretend from then on that it is UNIX as far as I can.

Cygwin's installer has a package selection stage; you should be able to 
find bzip2, probably in some kind of "utilities" section. Grab Cygwin's 
tar package as well.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Begginers problem : tar: Error opening archive: Can't initialize filter; unable to run program "bzip2 -d

2018-12-29 Thread Michael Torrie
On 12/29/2018 01:15 AM, Rand .J wrote:
> I'm trying to run this code from : https://github.com/pnnl/*safekit* ,using
> cmd on windows 10, I already installed python. when I type the command: tar
> -xjvf data_examples.tar.bz2
> 
> I keep getting the error: tar: Error opening archive: Can't initialize
> filter; unable to run program "bzip2 -d"

It means that tar is unable to run bzip2 as a child process. Most likely
it simply cannot find it.
> I have tried to download bzip2 through easy-7 zip and GnuWin32 , but it
> didn't work. Can any one help me? Thank you

Is bzip2 in the path? Can you run it from the command line by itself?
Try just typing this at cmd: bzip2 --help

If that won't work, then you need to put bzip2 in the system PATH so tar
can find it.

Normally I run tar and friends via either cygwin or MingW's MSYS
environment where tar and bzip2 are installed from packages and are
already in the right place.


-- 
https://mail.python.org/mailman/listinfo/python-list