Skip to content

Instantly share code, notes, and snippets.

@moritz
Created March 5, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/766d05b4e6400a49db2166f09e80aea8 to your computer and use it in GitHub Desktop.
Save moritz/766d05b4e6400a49db2166f09e80aea8 to your computer and use it in GitHub Desktop.
Perl 6's Inline::Python: trouble with named arguments, attributes
use v6;
use Inline::Python;
use requests:from<Python>;
# works:
my $response = requests::get('https://irclog.perlgeek.de/');
# fails:
# my $response = requests::get('https://irclog.perlgeek.de/', headers => { Accepts => 'application/json' });
# Unexpected named argument 'headers' passed
# in sub at /home/moritz/p6/rakudo/install/share/perl6/site/sources/ED160F40E4F4A7D08FA4CD155799315ACDC59234 (Inline::Python) line 423
# in block <unit> at inline.p6 line 9
# fails:
say $response.text;
# 'unicode' object is not callable
# in method handle_python_exception at /home/moritz/p6/rakudo/install/share/perl6/site/sources/ED160F40E4F4A7D08FA4CD155799315ACDC59234 (Inline::Python) line 350
# in method invoke at /home/moritz/p6/rakudo/install/share/perl6/site/sources/ED160F40E4F4A7D08FA4CD155799315ACDC59234 (Inline::Python) line 388
# in block at /home/moritz/p6/rakudo/install/share/perl6/site/sources/ED160F40E4F4A7D08FA4CD155799315ACDC59234 (Inline::Python) line 586
# in block <unit> at inline.p6 line 18
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment