Re: How to run self-contained Python scripts who don't need Python installation?

2017-06-09 Thread Akira Li
"Juan C." writes: > I need to run some Python 3.6.0 scripts on the users' machines (W7 and > W10) in an enterprise environment, but I can't install Python on those > machines. I tried looking for those "py to exe", but sadly they don't > support Python 3.6.0. I've tried PyInstaller (development

Re: Is An Element of a Sequence an Object?

2017-06-04 Thread Akira Li
Jon Forrest writes: > I'm learning about Python. A book I'm reading about it > says "... > a string in Python is a sequence. correct. > A sequence is an ordered collection of objects". correct. https://docs.python.org/3/glossary.html#term-sequence > This implies that each character in a strin

Re: Transitioning from Linux to Windows

2017-06-04 Thread Akira Li
chitt...@uah.edu writes: > ... > Ideally, I would like to set up the user on their Windows 7/10 system > so that they can "login" to the ubuntu system (say putty) - change > working directory (to where desired) - run the script (on the ubuntu > system) - and scp the file back to the windows deskto

Re: Top Python Interview Questions

2017-05-26 Thread Akira Li
Terry Reedy writes: > On 5/26/2017 1:03 AM, Aarusha wrote: >> PYTHON INTERVIEW QUESTIONS >> >> Mindmajix has compiled Python Interview questions which would >> benefit the learners to attend the Python interviews. >> >> Q. How is Python executed? > > It depends on the implementation (interpreter

Re: User Interface Suggestions? (newbie)

2016-10-05 Thread Akira Li
Beverly Howard writes: >...snip... > A primary question would be, "What are options for building a display > that would update displayed values without scrolling?" To rewrite only the last character, you could use '\b': import os import itertools import time for c in map(str.encode, ite

Re: Interacting with Subprocesses

2016-05-04 Thread Akira Li
Terry Reedy writes: > On 5/4/2016 2:41 PM, Dick Holmes wrote: >> I am attempting to write a Python program that will interact with >> a (non-Python) process. The programs will run under MinGW. The >> process can use stdin/stdout commands and responses and can work >> with pipes. The problem I'm h

Re: Interacting with Subprocesses

2016-05-04 Thread Akira Li
Dick Holmes writes: > I am attempting to write a Python program that will interact with > a (non-Python) process. The programs will run under MinGW. The > process can use stdin/stdout commands and responses and can work > with pipes. The problem I'm having is that I can't find any > way in Pytho

Re: threading bug in strptime

2015-10-06 Thread Akira Li
Larry Martell writes: > We have been trying to figure out an intermittent problem where a > thread would fail with this: > > AttributeError: 'module' object has no attribute '_strptime' > > Even though we were importing datetime. After much banging our heads > against the wall, we found this: > >

Re: Idiosyncratic python

2015-09-24 Thread Akira Li
Mark Lawrence writes: > On 24/09/2015 07:02, Steven D'Aprano wrote: >> I was looking at an in-house code base today, and the author seems to have a >> rather idiosyncratic approach to Python. For example: >> >> for k, v in mydict.items(): >> del(k) >> ... >> >> instead of the more obvio

Re: Modify environment variable for subprocess

2015-09-23 Thread Akira Li
loial writes: > I need to modify the LIBPATH environment variable when running a > process via subprocess, but otherwise retain the existing environment. > > Whats the best way to do that? Pass env=dict(os.environ, LIBPATH=value) parameter: import os import subprocess subprocess.check

Re: A little test for you Guys😜

2015-09-22 Thread Akira Li
Python_Teacher via Python-list writes: ... > Let's define the function plural : > > def plural(words): > plurals = [] > for word in words: >plurals.append(word + 's') > return plurals > > for word in plural(['cabagge','owl','toy']): > print word plural() should accept a s

Re: Lightwight socket IO wrapper

2015-09-20 Thread Akira Li
"James Harris" writes: ... > There are a few things and more crop up as time goes on. For example, > over TCP it would be helpful to have a function to receive a specific > number of bytes or one to read bytes until reaching a certain > delimiter such as newline or zero or space etc. The answer

Re: Lightwight socket IO wrapper

2015-09-20 Thread Akira Li
"James Harris" writes: > I guess there have been many attempts to make socket IO easier to > handle and a good number of those have been in Python. > > The trouble with trying to improve something which is already well > designed (and conciously left as is) is that the so-called improvement > can

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Akira Li
"James Harris" writes: ... > Needless to say, on a test Windows machine AF_UNIX is not present. The > only cross-platform option, therefore, seems to be to use each > subthread's select()s to monitor two AF_INET sockets: the one to the > client and a control one from the master thread. I would se

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Ned Batchelder writes: > On Monday, September 14, 2015 at 3:32:46 PM UTC-4, Akira Li wrote: >> Ned Batchelder writes: >> ... >> > What do you feel is missing from Steven's diagram? >> >> I don't feel anything missing because I don't expect th

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Ned Batchelder writes: ... > What do you feel is missing from Steven's diagram? I don't feel anything missing because I don't expect the model to be more detailed. -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Random832 writes: > On Mon, Sep 14, 2015, at 13:45, Akira Li wrote: >>[box + arrow pointing to] + object == parcel tag + object > > The problem is that if there are multiple namespaces, or if you've also > got to include references from within other objects such as lis

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Random832 writes: > On Mon, Sep 14, 2015, at 10:48, Akira Li wrote: >> start, stop, step attributes (corresponding Python ints) may not exist >> ("the objects we've talking about have never been created") until you >> request them explicitly. > > That

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Steven D'Aprano writes: > On Mon, 14 Sep 2015 01:23 pm, Akira Li wrote: > >> Steven D'Aprano writes: >> >>> On Mon, 14 Sep 2015 11:22 am, Akira Li wrote: >>>> Look at the last example: >>>> http://thread.gmane.org/gmane.comp.python

Re: Terminology: "reference" versus "pointer"

2015-09-14 Thread Akira Li
Random832 writes: ... > Why can't it describe range(1)? A range object in my model would include > the start, stop, and step; _not_ the contents of what you would get by > iterating over it; since that's not part of the physical structure of > the object, but the consequences of calling methods on

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Steven D'Aprano writes: > On Mon, 14 Sep 2015 11:22 am, Akira Li wrote: >> Look at the last example: >> http://thread.gmane.org/gmane.comp.python.general/782626/focus=782704 > > > I'm afraid that page is broken in my browser. Can you not summarise, or link &

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Chris Angelico writes: > On Mon, Sep 14, 2015 at 11:22 AM, Akira Li <4kir4...@gmail.com> wrote: >> Steven D'Aprano writes: >> >>> On Mon, 14 Sep 2015 09:17 am, Akira Li wrote: >>> >>>> I don't see why the model that can

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Steven D'Aprano writes: > On Mon, 14 Sep 2015 09:17 am, Akira Li wrote: > >> I don't see why the model that can't describe range(1) in Python 3 >> pretends to be complete. > > > Please explain. > > range(1) returns a range instance. What is

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Chris Angelico writes: > On Mon, Sep 14, 2015 at 9:17 AM, Akira Li <4kir4...@gmail.com> wrote: >> If you mean this quote from [1]: >> >> Although we commonly refer to "variables" even in Python (because it's >> common terminology), we real

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Random832 writes: > Akira Li <4kir4...@gmail.com> writes: >> I'm not sure what "parcel tags" model is but if you mean these >> pictures[1] than it works in this case as well as any other (take *a*, >> *b* nametags, put them on the correspondin

Re: Terminology: "reference" versus "pointer"

2015-09-13 Thread Akira Li
Random832 writes: > Akira Li <4kir4...@gmail.com> writes: >>Rustom Mody writes: >>> viz. I have two variables (or names!) say a and b which look the same >>>>>> a >>> [[1,2],[1,2]] >>>>>> b >>> [[1,2],[1,2]] &

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Akira Li
Rustom Mody writes: > On Saturday, September 12, 2015 at 11:26:18 PM UTC+5:30, Akira Li wrote: >> Rustom Mody writes: >> >> > On Saturday, September 12, 2015 at 8:11:49 PM UTC+5:30, Laura Creighton >> > wrote: >> >> In a message of Sat, 1

Re: Are there any "correct" implementations of tzinfo?

2015-09-12 Thread Akira Li
Random832 writes: > I was trying to find out how arithmetic on aware datetimes is "supposed > to" work, and tested with pytz. When I posted asking why it behaves this > way I was told that pytz doesn't behave correctly according to the way > the API was designed. The tzlocal module, on the other

Re: Terminology: "reference" versus "pointer"

2015-09-12 Thread Akira Li
Rustom Mody writes: > On Saturday, September 12, 2015 at 8:11:49 PM UTC+5:30, Laura Creighton wrote: >> In a message of Sat, 12 Sep 2015 05:46:35 -0700, Rustom Mody writes: >> >How about lay-English ontology in which "point to" and "refer to" are fairly >> >synonymous? >> >> This I have found is

Re: Context-aware return

2015-09-10 Thread Akira Li
Grant Edwards writes: > On 2015-09-10, Steven D'Aprano wrote: > >> I have a function which is intended for use at the interactive interpreter, >> but may sometimes be used non-interactively. I wish to change it's output >> depending on the context of how it is being called. > > [...] > > Sounds

Re: Python handles globals badly.

2015-09-08 Thread Akira Li
Vladimir Ignatov writes: >>> I had some experience programming in Lua and I'd say - that language >>> is bad example to follow. >>> Indexes start with 1 (I am not kidding) >> >> What is so bad about that? > > It's different from the rest 99.9% of languages for no particular reason. > > ( => perf

Re: passing double quotes in subprocess

2015-09-08 Thread Akira Li
loial writes: > I need to execute an external shell script via subprocess on Linux. > > One of the parameters needs to be passed inside double quotes > > But the double quotes do not appear to be passed to the script > > I am using : > > myscript = '/home/john/myscript' > commandline = myscript

Re: asyncio, coroutines, etc. and simultaneous execution

2015-08-23 Thread Akira Li
Charles Hixson writes: > If I understand correctly asyncio, coroutines, etc. (and, of course, > Threads) are not simultaneously executed, and that if one wants that > one must still use multiprocessing. But I'm not sure. The note is > still there at the start of threading, so I'm pretty sure ab

Re: Sandboxing Python

2015-08-23 Thread Akira Li
Mark Lawrence writes: > I was always led to believe that the subject was a difficult thing to > do, but here > https://www.reddit.com/r/learnpython/comments/3huz4x/how_to_do_math_inside_raw_input/ > is a safe solution in only 23 characters, or are there any discernable > flaws in it? Related: h

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-07 Thread Akira Li
Terry Reedy writes: > There have been discussions, such as today on Idle-sig , about who > uses Idle and who we should design it for. If you use Idle in any > way, or know of or teach classes using Idle, please answer as many of > the questions below as you are willing, and as are appropriate >

Re: Convert between timezones

2015-07-31 Thread Akira Li
Thomas 'PointedEars' Lahn writes: > [X-Post & F'up2 comp.unix.shell] > > Chris Angelico wrote: > >> On Fri, Jul 31, 2015 at 6:15 PM, Cameron Simpson wrote: >>> Actually, bash has no timezone support but the date command _does_, and >>> probably neither better nor worse than Python. All one has t

Re: Matplotlib X-axis timezone trouble

2015-07-03 Thread Akira Li
Peter Pearson writes: > The following code produces a plot with a line running from (9:30, 0) to > (10:30, 1), not from (8:30, 0) to (9:30, 1) as I desire. > > If I use timezone None instead of pacific, the plot is as desired, but > of course that doesn't solve the general problem of which this i

Re: Simple background sound effect playback

2014-12-21 Thread Akira Li
"Jacob Kruger" writes: > Would prefer to use something free, that could work somewhat > cross-platform, but, my primary target is for windows OS, and would > primarily just want to be able to easily trigger playback of either > .wav or .mp3 background sound effects, but, yes, would also be nice t

Re: Creating interactive command-line Python app?

2014-12-13 Thread Akira Li
Steven D'Aprano writes: > rfreundlic...@colonial.net wrote: > >> um, what if I want to USE a command line for python WITHOUT downloading or >> installing it > > Who are you talking to? What is the context? > > Like all software, you can't use Python apps without all their dependencies > being

Re: How to make subprocess run for 60 sec?

2014-12-12 Thread Akira Li
Dan Stromberg writes: > On Fri, Dec 12, 2014 at 12:48 AM, Robert Clove wrote: >> Hi All, >> >> I have the following python script that runs. >> I want is to run the subprocess to run for 60 sec and then send the SIGINT >> signal to subprocess and write the output in file. >> >> #!/usr/bin/python

Re: time.monotonic() roll over

2014-12-05 Thread Akira Li
Dave Angel writes: ...many words about sleep()... > Since the OS has no way of knowing whether the thing being waited for > is a thread, another process, a human being, a network operation, or > the end of the world, the interpretation of sleep needs to be the most > conservative one. There are

Re: time.monotonic() roll over

2014-12-04 Thread Akira Li
Ian Kelly writes: > On Thu, Dec 4, 2014 at 11:09 AM, Marko Rauhamaa wrote: >> >> Chris Angelico : >> >> > It's not a Python issue. Python can't do anything more than ask the >> > system, and if the system's value rolls over several times a year, >> > Python can't magically cure that. The informa

Re: Do you like the current design of python.org?

2014-12-04 Thread Akira Li
Peter Otten <__pete...@web.de> writes: > Did you ever hit the "Socialize" button? Are you eager to see the latest > tweets when you are reading a PEP? Do you run away screaming from a page > where nothing moves without you hitting a button? Do you appreciate the > choice between ten or so links

Re: Iterate over text file, discarding some lines via context manager

2014-11-28 Thread Akira Li
Ned Batchelder writes: > On 11/28/14 10:22 AM, Dave Angel wrote: >> On 11/28/2014 10:04 AM, fetchinson . wrote: >>> Hi all, >>> >>> I have a feeling that I should solve this by a context manager but >>> since I've never used them I'm not sure what the optimal (in the >>> python sense) solution is

Re: Asyncio problem, looking for advice.

2014-11-28 Thread Akira Li
Benjamin Risher writes: > On Friday, November 28, 2014 6:12:20 AM UTC-6, Akira Li wrote: >> Benjamin Risher writes: >> >> > Hello all, >> > >> > I'm working on a project to learn asyncio and network programming. >> > What I'm try

Re: localization virt-manager

2014-11-28 Thread Akira Li
Беляев Игорь writes: > I can't install localization for Virt-manager (virt-manager launched on > python2.7 (Windows XP)). virt-manager is a GUI for KVM, Xen, LXC virtual machines. It is a Linux application. > How do I correctly install location? Do you mean *locale*? > How can I change the

Re: Asyncio problem, looking for advice.

2014-11-28 Thread Akira Li
Benjamin Risher writes: > Hello all, > > I'm working on a project to learn asyncio and network programming. What I'm > trying to do is forward a connection from myself to another machine. Kind of > like an asynchronous python implementation of fpipe. > > In a nutshell: > > 1 --> start a serve

Re: Curious function argument

2014-11-27 Thread Akira Li
"ast" writes: > Hello > > I saw in a code from a previous message in this forum > a curious function argument. > > def test(x=[0]): > print(x[0]) ## Poor man's object > x[0] += 1 > test() > 0 test() > 1 test() > 2 > > I understand that the author wants to implement a glo

Re: html page mail link to webmail program

2014-11-27 Thread Akira Li
Ethan Furman writes: > On 11/11/2014 05:08 PM, Ben Finney wrote: >> Ethan Furman writes: >> >>> My wife (using a Win7 machine) will be on a web page that has a link >>> to mail somebody. She clicks on it, and it opens the currently >>> installed but unused Thunderbird. >>> >>> Ideally, what wou

Re: Moving a window on the screen

2014-11-08 Thread Akira Li
Terry Reedy writes: > On 11/8/2014 11:35 AM, Akira Li wrote: >> "ast" writes: >> >>> Ok, thx, it works now with: >>> >>> import tkinter >>> fen = tkinter.Tk() >>> >>> x=0 >>> >>> def moveW(): >

Re: Moving a window on the screen

2014-11-08 Thread Akira Li
"ast" writes: > Ok, thx, it works now with: > > import tkinter > fen = tkinter.Tk() > > x=0 > > def moveW(): >global x >fen.geometry("200x200+%d+10" % x) >x = x + 10 >if (x < 1200): >fen.after(50, moveW) > > moveW() In general, to avoid the start time "drift" [1], you

Re: Challenge: optimizing isqrt

2014-11-01 Thread Akira Li
Steven D'Aprano writes: > There is an algorithm for calculating the integer square root of any > positive integer using only integer operations: > > def isqrt(n): > if n < 0: raise ValueError > if n == 0: > return 0 > bits = n.bit_length() > a, b = divmod(bits, 2) > x

Re: Emulating py2exe for python version 3 and above

2014-10-31 Thread Akira Li
Ian Dickinson writes: > Can i emulate py2exe for python version 3 and above i also use pygame any > suggestions for a basic staring script would be greatly appreciated > > py2exe supports Python 3.3+ Actually, default installers from pypi support only Python 3. I see unofficial pygame's Windows

Re: Saving a file "in the background" -- How?

2014-10-31 Thread Akira Li
Virgil Stokes writes: > While running a python program I need to save some of the data that is > being created. I would like to save the data to a file on a disk > according to a periodical schedule (e.g. every 10 > minutes). Initially, the amount of data is small (< 1 MB) but after > sometime t

Re: Timezones

2014-10-05 Thread Akira Li
Seymore4Head writes: > This is not a new video, but it is new to me. > https://www.youtube.com/watch?v=-5wpm-gesOY > > Any links to some easy to follow time zone math? The point of the video is that you should not do it yourself, use already written tools. It is quite comprehensive video. Here'

Re: GCD in Fractions

2014-09-25 Thread Akira Li
Mark Lawrence writes: > On 24/09/2014 12:14, Mark Dickinson wrote: >> Mark Lawrence yahoo.co.uk> writes: >>> Somebody got there first http://bugs.python.org/issue22477 >> >> I think there's good reason to suspect that Brian Gladman and >> blindanagram are one and the same. :-) >> > sorted("B

Re: CSV methodology

2014-09-15 Thread Akira Li
je...@newsguy.com writes: > Hello. Back in the '80s, I wrote a fractal generator, which, over the years, > I've modified/etc to run under Windows. I've been an Assembly Language > programmer for decades. Recently, I decided to learn a new language, > and decided on Python, and I just love it, a

Re: subprocess module usage

2014-09-01 Thread Akira Li
Earl Lapus writes: > Hi, > > I made simple test program using the subprocess module (see attached: > exec_cmd.py). I ran it passing variations of 'ls' command options. > > I encounter exceptions every time I use '-l' options. Example runs > where exception occurs: > # ./exec_cmd.py ls -al > # ./e

Re: Reading from sys.stdin reads the whole file in

2014-08-28 Thread Akira Li
Chris Angelico writes: > On Wed, Aug 27, 2014 at 4:37 PM, Steven D'Aprano wrote: >> On Wed, 27 Aug 2014 08:29:20 +0300, Marko Rauhamaa wrote: >> >>> Try flushing after each print. >> >> Doesn't help. > > It does, but insufficiently. If slurp.py is run under Py3, it works > fine; or take Naoki's

Re: Media Conversion Using Python - Converting MP3 to Other Formats

2014-08-28 Thread Akira Li
Mark Lawrence writes: > On 25/08/2014 16:28, Parth Trivedi wrote: >> Dear All, >> >> I need some help of yours. I want to convert audio in MP3 format to >> other formats including uncompressed raw format, WAV etc. and I am using >> python 2.7. Is there any built-in module I can use or any third p

Re: Efficiency, threading, and concurrent.futures

2014-08-20 Thread Akira Li
Rob Gaddi writes: > I've got a situation where I'll be asking an I/O bound process to do > some work (querying an RS-232 device) while my main code is off > running a sleep() bound process. Everyone always talks about how > expensive thread creation is, so I figured I'd test it out in an > IPyth

Re: How to look up historical time zones by date and location

2014-08-20 Thread Akira Li
luofeiyu writes: > http://www.thefreedictionary.com/time+zone > > time zone Any of the 24 divisions of the Earth's surface used to > determine the local time for any given locality. > Each zone is roughly 15° of longitude in width, with local variations > for economic and political convenience. >

Re: how to copy emails into local directory?

2014-08-20 Thread Akira Li
luofeiyu writes: > import imaplib,email > user="" > password="" > con=imaplib.IMAP4_SSL('imap.gmail.com') > con.login(user,password) > con.list() > ('OK', [b'(\\HasNoChildren) "/" "INBOX"', b'(\\Noselect \\HasChildren) > "/" "[Gma > il]"', b'(\\HasNoChildren \\Junk) "/" "[Gmail]/&V4NXPpCu

Re: pexpect - logging input AND output

2014-08-20 Thread Akira Li
sj.constant...@gmail.com writes: > i have a script running a few commands on a network device. i can't > seem to figure out how to log both the input and output of what the > pexpect script initiates and responds to. > > child = pexpect.spawn ('telnet '+ ip) > child.expect ('.*:*') > child.sendlin

Re: how to change the time string into number?

2014-08-20 Thread Akira Li
luofeiyu writes: > s="Aug" > > how can i change it into 8 with some python time module? months = (None, # dummy, to start month indices from 1 "Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec" ) month_number = months.index(month_abbr) # month_abbr == "Aug

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Akira Li
Virgil Stokes writes: > Suppose I have a directory C:/Test that is either empty or contains > more than 200 files, all with the same extension (e.g. *.txt). How > can I determine if the directory is empty WITHOUT the generation of a > list of the file names in it (e.g. using os.listdir('C:/Te

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Akira Li
Wiktor writes: > On Mon, 04 Aug 2014 15:17:04 -0400, Terry Reedy wrote: > >>>I'm taking next step, so I tried to draw nice frame around menu (that's >>> why I posted yesterday). >> >> Is there no working codepage with ascii text and the line chars? I >> suppose I am not surprised if not. > >

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Akira Li
Albert-Jan Roskam writes: > I find the following obscure (to me at least) use of type() useful > exactly for this "bag of attributes" use case: employee = type("Employee", (object,), {}) employee.name = "John Doe" employee.position = "Python programmer" You could write it as:

Re: converting ISO8601 date and time string representations to datetime

2014-08-01 Thread Akira Li
Wolfgang Maier writes: > On 08/01/2014 01:30 AM, Roy Smith wrote: >> In article , >> Albert-Jan Roskam wrote: >> In article , Wolfgang Maier wrote: > Hi, > I'm trying to convert ISO8601-compliant strings representing dates or > dates and times into datetime.datetime

Re: Bug with help (was Re: Getting a list of all modules)

2014-08-01 Thread Akira Li
Mark Lawrence writes: > On 31/07/2014 19:55, Akira Li wrote: >> Steven D'Aprano writes: >> >>> I'm looking for a programmatic way to get a list of all Python modules >>> and packages. Not just those already imported, but all those which >>

Re: What is best way to learn Python for advanced developer?

2014-07-31 Thread Akira Li
guirec.cor...@gmail.com writes: > I am a Ruby developer and I want to program in Python. I know how to > do simple things like create classes, methods, variables and all the > basics. I want to know more. I want to know what is the Python > philosophy, how to test, how to create maintenable softwa

Re: Getting a list of all modules

2014-07-31 Thread Akira Li
Steven D'Aprano writes: > I'm looking for a programmatic way to get a list of all Python modules > and packages. Not just those already imported, but all those which > *could* be imported. ... > Is this problem already solved? Can anyone make any suggestions? Look at how `help('modules')` is i

Re: How to index an array with even steps?

2014-07-25 Thread Akira Li
fl writes: > In Python, ':' is used to indicate range (while in Matlab I know it can be > used > to control steps). How to index an array with 0, 5, 10, 15...995? Just use slicing: >>> L = range(1000) # your array goes here >>> L[::5] [0, 5, 10, 15, ..., 995] # Python 2 range(0, 1000,

Re: Unicode, stdout, and stderr

2014-07-22 Thread Akira Li
"Frank Millman" writes: > "Steven D'Aprano" wrote in message > news:53ce0b96$0$29897$c3e8da3$54964...@news.astraweb.com... >> On Tue, 22 Jul 2014 08:18:08 +0200, Frank Millman wrote: >> >>> This is not important, but I would appreciate it if someone could >>> explain the following, run from cmd

Re: OOP with MyTime

2014-07-02 Thread Akira Li
kjaku...@gmail.com writes: > I'm trying to write a boolean function that takes two Mytime objects, t1 and > t2 as arguments, and returns True if the object falls inbetween the two times. > > This is a question from the How to Think Like a Computer Scientist book, and > I need help. > > What I've

Re: How to get Timezone from latitude/longitude ?

2014-06-25 Thread Akira Li
Larry Martell writes: > On Wed, Jun 25, 2014 at 8:53 AM, wrote: >> Hi, >> >> I'm looking for a python-library which can help me to get Timezone >> and Timezone-offset(UTC) from latitude/longitude. >> >> I'm not able to find an easy way to do it. >> >> Thanks in advance. > > It took me 30 second

Re: asyncio: wrapping a subprocess in a server

2014-06-25 Thread Akira Li
David Farler writes: > Hi all, > > I'm trying to vend some kind of server that spawns a client-unique > subprocess when a client connects. The server acts as a middleman, > receiving structure messages from the client, sending input to the > subprocess, and packaging up subprocess data before sen

Re: Forking PyPI package

2014-06-06 Thread Akira Li
Wiktor writes: > On Fri, 6 Jun 2014 03:37:56 +1000, Chris Angelico wrote: > >> On Fri, Jun 6, 2014 at 2:56 AM, Wiktor wrote: >>> I guess, I'll try to do what Chris proposed. Forget about this >>> implementation and write python script from the scratch looking only at the >>> original JavaScrip

Re: Python 3.2 has some deadly infection

2014-06-06 Thread Akira Li
Marko Rauhamaa writes: > Steven D'Aprano : > >> Nevertheless, there are important abstractions that are written on top >> of the bytes layer, and in the Unix and Linux world, the most >> important abstraction is *text*. In the Unix world, text formats and >> text processing is much more common in

Re: Python 3.2 has some deadly infection

2014-06-04 Thread Akira Li
Steven D'Aprano writes: > On Tue, 03 Jun 2014 15:18:19 +0100, Robin Becker wrote: > >> Isn't it a bit old fashioned to think everything is connected to a >> console? > > The whole concept of stdin and stdout is based on the idea of having a > console to read from and write to. Otherwise, what wo

Re: Segmentation fault (core dumped) while using Cplex Python API

2014-06-01 Thread Akira Li
varun...@gmail.com writes: > Hello Everyone, > > I am trying to solve a mixed-integer problem using Cplex Python API > and I get this error Segmentation fault (core dumped). i am not able > to figure out the reason for this. > Traceback > > srva@hades:~$ python RW10.py --output test --logPath log

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Akira Li
Antoon Pardon writes: > op 14-05-14 18:24, Akira Li schreef: >> Antoon Pardon writes: >> >>> This is the code I run (python 3.3) >>> >>> host = ... >>> user = ... >>> passwd = ... >>> >>> from ftplib import FTP >

Re: httplib with NETRC authentication

2014-05-14 Thread Akira Li
pratibha natani writes: > Hi, > > I am trying to establish http connection to a gerrit host using netrc > authentication. I have a netrc file created with following entries: > machine host1.com login name password pass > > I did a debug and saw that my netrc file is being read correctly. Also in

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Akira Li
Antoon Pardon writes: > This is the code I run (python 3.3) > > host = ... > user = ... > passwd = ... > > from ftplib import FTP > > ftp = FTP(host, user, passwd) > ftp.mkd(b'NewDir') > ftp.rmd(b'NewDir') > > This is the traceback > > Traceback (most recent call last): > File "ftp-problem", li

Re: httplib with NETRC authentication

2014-05-14 Thread Akira Li
Chris Angelico writes: > On Wed, May 14, 2014 at 9:33 AM, pratibha natani > wrote: >> I am trying to establish http connection to a gerrit host using >> netrc authentication. I have a netrc file created with following >> entries: >> machine host1.com login name password pass >> >> I did a debug