--- Log opened Tue May 20 00:00:26 2014 |
00:12 | <&McMartin> | Like, #!/usr/bin/python requires that python be in /usr/bin, which it isn't always. |
00:13 | <&McMartin> | And the documented solution is #!/bin/env python |
00:13 | <&McMartin> | But env is not always in /bin. |
00:55 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
01:00 | | Derakon[AFK] is now known as Derakon |
01:01 | <&Derakon> | McM: I guess you could do something like "#!`find . -name env -exec {} python`" but then you're relying on find being what you expect it to be~ |
01:01 | <&Derakon> | In short, I expect you're boned. |
01:04 | <&McMartin> | Well |
01:04 | <&McMartin> | I expect to say "if you're one something wacky, edit line one of the script, you are a big boy" |
01:06 | <&Derakon> | Heh. |
01:07 | <&McMartin> | But it also means I'm going to reject the pull request re: using /bin/env instead |
01:07 | < Xires> | I think /usr/bin/env is a bit more common |
01:08 | <&McMartin> | Hm |
01:08 | <&McMartin> | If one were to make a /bin/sh script that invoked python by name, would that work? |
01:08 | < Xires> | not sure what LSB says about it |
01:08 | <&McMartin> | We're in "more work than telling them to update their line 1" |
01:08 | <&McMartin> | OK, I am explicitly rejecting the attitude "program to the standard and yell at people whose systems don't match it" |
01:09 | < Xires> | include a /bin/sh script that changes the line for them? |
01:09 | <&McMartin> | At that point, just have that be the invocation |
01:09 | <&McMartin> | That's an issue for people who want to package the thing, imo. |
01:09 | < Xires> | indeed..wrapper |
01:09 | <&McMartin> | It's got a distutils edition. |
01:10 | <&McMartin> | I think distutils might be smart enough to do the rewrites |
01:10 | < Xires> | bourne shell + sed should be good enough but a wrapper might make it unnecessary |
01:11 | <&McMartin> | Yeah |
01:11 | <&McMartin> | My inclination here is to say "don't have this be a last-minute change" |
01:11 | <&McMartin> | Since I'm prepping a 2.1 release when this came in |
01:12 | < Xires> | compile the script & run as binary?? |
01:13 | | Turaiel[Offline] [Brandon@Nightstar-5st1eu.mi.comcast.net] has joined #code |
01:14 | | Turaiel[Offline] is now known as Turaiel |
01:14 | <&McMartin> | Heh |
01:15 | <&McMartin> | That is the Windows solution~ |
01:15 | <&McMartin> | If there are good MinGW-compatible ahead-of-type Python compilers, I would love to try them out. |
01:15 | <&McMartin> | *ahead-of-time |
01:15 | <&McMartin> | I'm using py2exe right now and it's a bit of a slog getting everything packaged in with it. |
01:16 | <&McMartin> | (To clarify: This is a tri-platform pure-Python commandline application.) |
01:17 | <&McMartin> | So, py2exe on windows, script-that-modifies-the-pythonpath-temporarily for Mac and most Linux usecases, distutils for permanent installs. |
01:20 | < Xires> | okay, what about a shell script that executes the python contained within? almost like tail -n +2 $0 |
01:20 | <&McMartin> | Hah, you mean as a here document? |
01:21 | <&McMartin> | A possible solution but too late to hit the release vehicle I'm aiming for, I think. |
01:21 | < Xires> | can you tell python to begin executing a script at a specific line number? |
01:22 | <&McMartin> | The script is actually such that I suspect it replaces a single line of shell in the first place. |
01:23 | < Xires> | forgo the shebang and instruct that the script is meant to be run as 'py scriptfile'? |
01:23 | <&McMartin> | That's kinda how bin/env does it |
01:24 | < Xires> | indeed, but the issue being that you cannot trust the location of bin/env |
01:24 | <&McMartin> | Or anything else |
01:24 | <&McMartin> | I've been using /usr/bin/env for the main script for three years now, though |
01:25 | <&McMartin> | I may just shrug and standardize on that as more standard than Python's location. |
01:25 | < Xires> | #!`which env`? |
01:25 | <&McMartin> | Hah, does that even work? |
01:25 | <&McMartin> | I thought they had to be absolute constant paths |
01:26 | <&Derakon> | -bash: /tmp/t.sh `which: bad interpreter: No such file or directory |
01:27 | < Xires> | ci, the same |
01:27 | <&Derakon> | (This also does in the find-based approach I suggested earlier) |
01:28 | < Xires> | ci |
01:29 | <&McMartin> | Is "ci" short for something or just an affirmation? |
01:29 | | * McMartin is reading it like "sÃ" |
01:30 | < Xires> | it's pronounced the same |
01:32 | < Xires> | also the same meaning |
01:32 | | * McMartin nods. "Haven't encountered it before, is all." |
01:33 | < Xires> | found more commonly in Italian |
01:33 | <&McMartin> | Yeah |
01:34 | < Xires> | but mostly I just grew used to it after years of CVS |
01:34 | < Xires> | I think the here script is probably the most effective |
01:34 | <&McMartin> | Yeah |
01:35 | | HotShot[ipad] [HotShot@Nightstar-3dus18.hfc.comcastbusiness.net] has joined #code |
01:35 | <&McMartin> | Though it looks like the pull request here involves scripts that aren't the main ones |
01:35 | <&McMartin> | The main ones have been using /usr/bin/env for three years with nobody noticnig |
01:35 | < Xires> | no doubt |
01:35 | < Xires> | what's it failing on |
01:35 | < Xires> | (+?) |
01:35 | <&McMartin> | It might not be. |
01:35 | <&McMartin> | I think when it was /bin/env that failed on slackware but not Debian or Fedora |
01:36 | <&McMartin> | /usr/bin/python fails on NetBSD |
01:36 | < Xires> | Debian & Fedora symlink a lot of things in /bin to /usr/bin and vice-versa |
01:36 | < Xires> | Slackware tends to do this with much less frequency |
01:37 | < Xires> | Archlinux also prefers avoiding extraneous symlinks |
01:37 | < Xires> | I don't think it's LSB, but /usr/bin/env is definitely a de facto standard so most recent distributions will probably not show problems |
01:40 | < Xires> | if you know that /bin/sh is available on all platforms, then the here script is most likely to handle all those issues |
01:40 | < Xires> | kinda wish I could think of a good excuse for shar-ing the python script but that may cause even more problems |
01:41 | <&McMartin> | Hee |
01:41 | <&McMartin> | Yeah, we are well into "overengineering solutions to a minor problem" territory here |
01:41 | < Xires> | ci |
01:45 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
01:45 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
01:54 | | HotShot[ipad] [HotShot@Nightstar-3dus18.hfc.comcastbusiness.net] has quit [Ping timeout: 121 seconds] |
02:18 | | himi [fow035@Nightstar-q9amk4.ffp.csiro.au] has joined #code |
02:18 | | mode/#code [+o himi] by ChanServ |
02:44 | < [R]> | McMartin: /usr/bin/env (this is where it usually is) |
02:45 | | HotShot[ipad] [HotShot@Nightstar-1t2u26.mi.comcast.net] has joined #code |
02:46 | <&McMartin> | R: Yes. My annoyance is that "usually" leads to "now you have two problems" |
02:48 | < [R]> | Hailey1 ~ # ./tmp.sh |
02:48 | < [R]> | Hello, World! |
02:48 | < [R]> | Hailey1 ~ # cat !!:0 |
02:48 | < [R]> | cat ./tmp.sh |
02:48 | < [R]> | #!/bin/sh |
02:48 | < [R]> | python <<<"\\ |
02:48 | < [R]> | print('Hello, World!')" |
02:51 | | HotShot[ipad] [HotShot@Nightstar-1t2u26.mi.comcast.net] has quit [Ping timeout: 121 seconds] |
02:57 | < [R]> | Hailey1 ~ # ./tmp.sh ; cat tmp.sh |
02:57 | < [R]> | Hello, World! |
02:57 | < [R]> | #!/bin/sh |
02:57 | < [R]> | tail -n +4 $0 | python |
02:57 | < [R]> | exit |
02:57 | < [R]> | # This is where Python starts |
02:57 | < [R]> | # Note that the `exit` is needed to get bash to stop |
02:57 | < [R]> | print('Hello, World!') |
02:58 | < [R]> | ^Alternative |
03:11 | | celticminstrel [celticminst@Nightstar-g3ttc7.dsl.bell.ca] has quit [Ping timeout: 121 seconds] |
03:58 | | celticminstrel [celticminst@Nightstar-g3ttc7.dsl.bell.ca] has joined #code |
03:58 | | mode/#code [+o celticminstrel] by ChanServ |
04:00 | | Kindamoody|autojoin is now known as Kindamoody |
04:10 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Program Shutting down] |
04:37 | <~Vornicus> | Oh, I'm reminded, I've got a thing I wanted to do for a while and I have no idea whether it can be done or not. I have a file with commands for an interactive program in it, and I want to execute the program, run the commands in the file, and then get an interactive prompt afterwards. |
04:38 | <&Derakon> | So you want a program script that does some stuff and then gives you a REPL? |
04:39 | <~Vornicus> | The REPL of the program that I'm running the script in, specifically |
04:39 | <&Derakon> | Should be doable; see e.g. https://docs.python.org/2/library/code.html |
04:39 | <&Derakon> | See where it says [locals] in the parameters? |
04:39 | <&Derakon> | The locals() function returns the contents of the namespace in the current execution context, which, if done at the right place, should basically be the program state for your program. |
04:41 | <&Derakon> | import code |
04:41 | <&Derakon> | foo = 5 |
04:41 | <&Derakon> | code.interact("Hello, world!", local = locals()) |
04:41 | <&Derakon> | Hello, world! |
04:41 | <&Derakon> | >>> foo |
04:41 | <&Derakon> | 5 |
04:41 | <~Vornicus> | Part of the problem here is that much of the time I have no control over the program itself. |
04:41 | <&Derakon> | (Last 3 lines are the output of the program and me interacting with it) |
04:42 | <~Vornicus> | Like, I didn't write it. |
04:42 | <&Derakon> | ?you want to implement your own debugger? |
04:42 | <~Vornicus> | No, I want to |
04:43 | <~Vornicus> | I have a program that is interactive. I didn't write it; I can't add this capability to it. |
04:44 | <~Vornicus> | What I have is a series of commands that I wish to execute often, and after which I want to be able to continue to command the program from stdin |
04:44 | <~Vornicus> | So piping or using an input file doesn't work straight-up: once the pipe or input file is exhausted, the program exits, which I don't want. |
04:45 | <&Derakon> | Mm, if by "interactive" you mean "already has a REPL in it" then you should be able to just import the script you want to run. |
04:46 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has quit [Ping timeout: 121 seconds] |
04:47 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has joined #code |
04:47 | | mode/#code [+o Orthia] by ChanServ |
05:03 | < [R]> | Vornicus: there's a simple readline program around that lets you apply readline() to things that don't normally provide it, just do: (cat intro; readline) | python |
05:03 | | Derakon is now known as Derakon[AFK] |
05:04 | < [R]> | (Or whatever you have as the program run) |
05:05 | < [R]> | However, IIRC Python offers python -i script.py |
05:05 | <~Vornicus> | That's approximately the goal. yay! |
05:06 | < [R]> | Which works better. |
05:06 | <~Vornicus> | Yeah. The difficulty is that it's not python |
05:06 | < [R]> | Ah yeah |
05:06 | < [R]> | I had to do this with node.js |
05:06 | < [R]> | Works sort-of well, just you do lose all the normal tab-complete stuff |
05:08 | <~Vornicus> | yeah |
05:12 | | macdjord|wurk is now known as macdjord |
05:21 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has quit [Ping timeout: 121 seconds] |
05:26 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has joined #code |
05:26 | | mode/#code [+o Orthia] by ChanServ |
05:46 | | RchrdB [RichardB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.] |
05:50 | | RchrdB [RichardB@Nightstar-c6u.vd5.170.83.IP] has joined #code |
06:11 | | Turaiel is now known as Turaiel[Offline] |
07:06 | | celticminstrel [celticminst@Nightstar-g3ttc7.dsl.bell.ca] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.] |
07:27 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has quit [Ping timeout: 121 seconds] |
07:36 | | Kindamoody is now known as Kindamoody|afk |
07:36 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has joined #code |
07:36 | | mode/#code [+o Orthia] by ChanServ |
07:44 | | macdjord is now known as macdjord|slep |
07:46 | | macdjord|slep [macdjord@Nightstar-7rac1r.mc.videotron.ca] has quit [[NS] Quit: âªRainbow Dash always dresses in style~âª] |
08:06 | | macdjord [macdjord@Nightstar-7rac1r.mc.videotron.ca] has joined #code |
08:06 | | mode/#code [+o macdjord] by ChanServ |
08:12 | | macdjord is now known as macdjord|slep |
08:33 | | Attilla [uid13723@Nightstar-ed0oqj.irccloud.com] has joined #code |
08:39 | | himi [fow035@Nightstar-q9amk4.ffp.csiro.au] has quit [Ping timeout: 121 seconds] |
09:41 | | ErikMesoy [Erik@Nightstar-6v0.mal.203.80.IP] has quit [Ping timeout: 121 seconds] |
09:44 | | ErikMesoy [Erik@Nightstar-48q.uk2.203.80.IP] has joined #code |
10:31 | | mode/#code [+o RchrdB] by ChanServ |
11:00 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
11:00 | | mode/#code [+o himi] by ChanServ |
11:19 | | thalass [thalass@Nightstar-1oulrh.bigpond.net.au] has joined #code |
11:19 | | mode/#code [+o thalass] by ChanServ |
11:33 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed] |
11:34 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
11:34 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
11:57 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code |
12:13 | | Syka [the@Nightstar-ld7.91g.151.1.IP] has joined #code |
12:52 | <@gnolam> | Well, cock. |
12:54 | <@gnolam> | Something apparently broke in the last update that couldn't possibly have broken. |
12:54 | < luke> | Computers: defying possibility, daily. |
12:55 | | thalass [thalass@Nightstar-1oulrh.bigpond.net.au] has quit [Ping timeout: 121 seconds] |
12:55 | <@gnolam> | And now: troubleshooting a process control that might require physical access to the machine being controlled, remotely. >_> |
12:56 | < luke> | That usually involves telephony and a competent person on the other end. |
13:07 | <~Vornicus> | okay curl is my tiny web grabbing god. |
13:09 | <@Azash> | "that couldn't possibly have broken" |
13:09 | <@Azash> | Congrats, ya jinxed it |
13:09 | <@RchrdB> | Vornicus, :) |
13:31 | <@gnolam> | I don't think jinxes are retroactive. |
13:33 | < luke> | It's reverse self-fufilling prophecy. |
13:34 | <@Azash> | But you probably thought so earlier |
13:35 | < luke> | This is bordering on confusing now. |
13:37 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving] |
13:37 | <@Azash> | luke: Pardon? |
13:38 | <@Azash> | Oh right |
13:38 | <@Azash> | What I meant was that gnolam probably had the thought "It couldn't possibly be X.." |
13:39 | <@Azash> | Before he confirmed it |
13:42 | | * TheWatcher readsup |
13:43 | <@TheWatcher> | curl is indeed awesome, when wrapped in a helper library that divorces the user from the soul-devouring vistas of mind-shattering horror that is the library C API |
13:45 | < luke> | Real programmers just call straight into the kernel. |
13:47 | <@TheWatcher> | After programming it in machine code, via front-panel switches? |
13:47 | | VirusJTG_ [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code |
13:48 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [Ping timeout: 121 seconds] |
13:51 | | You're now known as TheWatcher[d00m] |
13:54 | < luke> | TheWatcher[d00m]: No silly, in assembly with a modern assembler. |
13:55 | | macdjord|slep is now known as macdjord|wurk |
14:06 | | VirusJTG_ [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [Ping timeout: 121 seconds] |
14:12 | <@gnolam> | Well, that was... painless. |
14:13 | <@gnolam> | As in "unable to reproduce" and I think what went wrong the first time. |
14:14 | <@gnolam> | Phew. |
14:14 | <@gnolam> | Nothing had in fact broken! |
14:16 | | Syka [the@Nightstar-ld7.91g.151.1.IP] has quit [Ping timeout: 121 seconds] |
14:16 | <@gnolam> | *I think I know |
14:18 | < luke> | User error? |
14:19 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code |
14:21 | | Syka [the@Nightstar-ld7.91g.151.1.IP] has joined #code |
15:01 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [Ping timeout: 121 seconds] |
15:06 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code |
15:13 | | You're now known as TheWatcher |
15:51 | | JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code |
15:51 | | mode/#code [+o JackKnife] by ChanServ |
16:31 | | celticminstrel [celticminst@Nightstar-g3ttc7.dsl.bell.ca] has joined #code |
16:31 | | mode/#code [+o celticminstrel] by ChanServ |
16:51 | | Syka [the@Nightstar-ld7.91g.151.1.IP] has quit [Ping timeout: 121 seconds] |
17:16 | | * ErikMesoy receives feedback on his last programming exercise before exams. |
17:16 | <@celticminstrel> | Yay? |
17:16 | < ErikMesoy> | "Your answer on this question is correct, but your calculation is not." WTF. |
17:16 | < ErikMesoy> | I got 85/100, pass, good luck with the exams. |
17:16 | <@celticminstrel> | Uh, okay then. |
17:17 | < ErikMesoy> | But when I'm doing a Bayesian Probability Estimate that involves multiplying together several numbers in the 0-1 range, I'd be /very/ surprised to find that I actually did the wrong calculation and got the right answer. |
17:17 | < ErikMesoy> | I'd expect my calculation to be isomorphic to the "right" calculation, because this really seems like the sort of thing where a fuckup necessarily gives the wrong answer (it's not something where, for example, two sign errors will cancel out). |
17:18 | < ErikMesoy> | Oh well. Wrote a probability estimator, wrote a sentence parser, wrote some verb classifications, passed. Ready for exam in three weeks. |
17:58 | | Datawalke [Datawalke@Nightstar-kt8k7i.com] has joined #code |
19:01 | < ErikMesoy> | http://imgur.com/gallery/YWFLq |
19:23 | <@Azash> | How it feels finishing a programming project http://www.theonion.com/articles/study-most-high-school-graduates-woefully-unpre par,36074/ |
19:28 | < ErikMesoy> | Azash: what, have you been writing in a write-only language? |
19:29 | | Kindamoody|afk is now known as Kindamoody |
19:29 | <@Azash> | Not since I last PHPed |
19:36 | | mode/#code [+o ErikMesoy] by ChanServ |
19:44 | | [R] [rstamer@genoce.org] has quit [Ping timeout: 121 seconds] |
19:44 | | [R] [rstamer@Nightstar-d7h8ki.org] has joined #code |
20:09 | | Kindamoody is now known as Kindamoody[zZz] |
20:25 | | Attilla [uid13723@Nightstar-ed0oqj.irccloud.com] has quit [Ping timeout: 121 seconds] |
20:28 | | Attilla [uid13723@Nightstar-ed0oqj.irccloud.com] has joined #code |
22:06 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
22:06 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
22:06 | | HotShot[ipad] [HotShot@Nightstar-v7se27.try.wideopenwest.com] has joined #code |
22:34 | | HotShot[ipad] [HotShot@Nightstar-v7se27.try.wideopenwest.com] has quit [Connection closed] |
22:57 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
23:19 | | JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds] |
23:26 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [[NS] Quit: reboot] |
23:33 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code |
23:33 | | mode/#code [+ao McMartin McMartin] by ChanServ |
--- Log closed Wed May 21 00:00:42 2014 |