Re: create new python file

2013-06-04 Thread Tobiah
So, can i program within just by the print statement? Or do i have to do something else. it is completely indecipherable (to me at least) what you are saying, leave aside any issues with python. He said, "Oh, so writing python statements into a text file is as simple as printing them, referen

PYTHONPATH and module names

2013-07-01 Thread Tobiah
to be knowledgeable about existing python library names, or is having '.' in the python path just a bad idea? Is there a way, not having '.' in the path to explicitly specify the current directory? Something analogous to import ./foo ? Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHONPATH and module names

2013-07-01 Thread Tobiah
Are you familiar with absolute and relative imports: http://docs.python.org/release/2.5/whatsnew/pep-328.html Doesn't seem to work: Python 2.7.3 (default, May 10 2012, 13:31:18) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

Re: Parsing Text file

2013-07-02 Thread Tobiah
On 07/02/2013 12:30 PM, sas4...@gmail.com wrote: Somemore can be anything for instance: Sometext mail maskit Sometext rupee dollar maskit and so on.. Is there a way I can achieve this? How do we know whether we have Sometext? If it's really just a literal 'Sometext', then just print that wh

Re: how to calculate reputation

2013-07-02 Thread Tobiah
reputation += 2 * vote - 1 Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Deciding inheritance at instantiation?

2012-08-03 Thread Tobiah
I have a bunch of classes from another library (the html helpers from web2py). There are certain methods that I'd like to add to every one of them. So I'd like to put those methods in a class, and pass the parent at the time of instantiation. Web2py has a FORM class for instance. I'd like to g

Re: Deciding inheritance at instantiation?

2012-08-06 Thread Tobiah
On 08/03/2012 02:55 PM, Terry Reedy wrote: On 8/3/2012 4:48 PM, Tobiah wrote: I have a bunch of classes from another library (the html helpers from web2py). There are certain methods that I'd like to add to every one of them. So I'd like to put those methods in a class, and pass the

Re: [newbie] String to binary conversion

2012-08-06 Thread Tobiah
The binascii module looks like it might have something for you. I've never used it. Tobiah http://docs.python.org/library/binascii.html On 08/06/2012 01:46 PM, Mok-Kong Shen wrote: If I have a string "abcd" then, with 8-bit encoding of each character, there is a correspondin

Re: [newbie] String to binary conversion

2012-08-06 Thread Tobiah
On 08/06/2012 01:59 PM, Tobiah wrote: The binascii module looks like it might have something for you. I've never used it. Having actually read some of that doc, I see it's not what you want at all. Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: Deciding inheritance at instantiation?

2012-08-07 Thread Tobiah
Interesting stuff. Thanks. On 08/06/2012 07:53 PM, alex23 wrote: On Aug 4, 6:48 am, Tobiah wrote: I have a bunch of classes from another library (the html helpers from web2py). There are certain methods that I'd like to add to every one of them. So I'd like to put those methods

Re: A little morning puzzle

2012-09-20 Thread Tobiah
Here is my solution: ** Incredibly convoluted and maximally less concise solution than other offerings. ** Might be better ones though. Unlikely. Zing! -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting "empty" attachment with smtplib

2012-11-14 Thread Tobiah
I just found out that the attachment works fine when I read the mail from the gmail website. Thunderbird complains that the attachment is empty. Thanks, Toby On 11/14/2012 09:51 AM, Tobiah wrote: I've been sending an email blast out with smtplib and it's been working fine. I'

Re: Getting "empty" attachment with smtplib

2012-11-15 Thread Tobiah
attachment, and Thunderbird opened the .pdf just fine. Thanks for the suggestions. Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Python math is off by .000000000000045

2012-02-25 Thread Tobiah
> For every floating point > number there is a corresponding real number, but 0% of real numbers > can be represented exactly by floating point numbers. It seems to me that there are a great many real numbers that can be represented exactly by floating point numbers. The number 1 is an example.

Finding MIME type for a data stream

2012-03-08 Thread Tobiah
the 'magic' package might be of use, but I can't find any documentation for it. Also, it seems like image/png works for other types of image data, while image/foo does not, yet I'm afraid that not every browser will play along as nicely. Thanks! Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding MIME type for a data stream

2012-03-08 Thread Tobiah
On 03/08/2012 02:11 PM, Dave Angel wrote: > On 03/08/2012 04:55 PM, Tobiah wrote: >> I'm pulling image data from a database blob, and serving >> it from a web2py app. I have to send the correct >> Content-Type header, so I need to detect the image type. >> >>

Re: Finding MIME type for a data stream

2012-03-08 Thread Tobiah
Also, I realize that I could write the data to a file and then use one of the modules that want a file path. I would prefer not to do that. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding MIME type for a data stream

2012-03-08 Thread Tobiah
d use php to detect the image type, and store that in the database. Not quite as clean, but that would work. Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding MIME type for a data stream

2012-03-09 Thread Tobiah
On 03/08/2012 06:12 PM, Irmen de Jong wrote: > On 8-3-2012 23:34, Tobiah wrote: >> Also, I realize that I could write the data to a file >> and then use one of the modules that want a file path. >> I would prefer not to do that. >> >> Thanks >> > >

Re: Finding MIME type for a data stream

2012-03-09 Thread Tobiah
On 03/08/2012 06:04 PM, Dennis Lee Bieber wrote: > On Thu, 08 Mar 2012 15:40:13 -0800, Tobiah declaimed > the following in gmane.comp.python.general: > > >> Pasting images may sound weird, but I'm using a jquery >> widget called cleditor that takes image data from

Re: Finding MIME type for a data stream

2012-03-09 Thread Tobiah
eturned PNG So I'm doing: mime_type = "image/%s" % img.format.lower() I'm hoping that will work for any image type. Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Real time event accuracy

2012-05-09 Thread Tobiah
so appreciate suggestions and pointers to a suitable python MIDI library, and maybe an outline of what must be done to get the MIDI events to the other program's MIDI in. Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Real time event accuracy

2012-05-09 Thread Tobiah
> I don't think you can really do this accurately enough to get good > sound, but the basic mechanism is time.sleep(t) which takes a floating > point argument. That turns into the appropriate microsleep, I think. I think the time would have to come from a hardware clock. -- http://mail.python.or

Hiding token information from users

2011-08-23 Thread Tobiah
nconvenient to extract is fine. Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding token information from users

2011-08-23 Thread Tobiah
, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding token information from users

2011-08-23 Thread Tobiah
On 08/23/2011 09:55 AM, Steven D'Aprano wrote: Tobiah wrote: I really need some sort of algorithm that will let me take an unknown string and generate the encrypted bit on the fly. Google broken for you? *wink* I had some requirements in the OP that I could not find a solutio

Re: is there any principle when writing python function

2011-08-26 Thread Tobiah
Furthermore: If you are moving code out of one function to ONLY be called by that ONE function then you are a bad programmer and should have your editor taken away for six months. You should ONLY create more func/methods if those func/methods will be called from two or more places in the code. T

datetime.datetime and mysql different after python2.3

2011-06-01 Thread Tobiah
I get: 2010-07-06 09:20:45.00 Put in python2.4 and greater, I get this: 2010-07-06 So I'm having trouble adding the two to get one datetime. Thanks for any insight. Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime.datetime and mysql different after python2.3

2011-06-01 Thread Tobiah
> import datetime > date, time = get_fields() # for example > print str(type(date)), str((type(time))) > print str(date + time) News reader stripped newlines -- http://mail.python.org/mailman/listinfo/python-list

Midi output timing?

2017-09-07 Thread Tobiah
I'd like to use a python program to send out MIDI events to another program. I've done in the past by generating scores for csound which would do the MIDI output. The apparent hurdle is the timing bit. I've seen packages that allow the creation of MIDI events, but given a list of events of arb

Question about modules documentation

2017-09-15 Thread Tobiah
In this doc: https://docs.python.org/2/tutorial/modules.html Near the top it states: Modules can import other modules. It is customary but not required to place all import statements at the beginning of a module (or script, for that matter). The imported m

Re: Question about modules documentation

2017-09-15 Thread Tobiah
Re-reading I guess the plural refers to the multiple modules referenced in the first sentence. It was probably written that way before someone inserted the bit about the customary placement, which greatly clouds the connection. On 09/15/2017 09:03 AM, Tobiah wrote: > In this

Re: Question about modules documentation

2017-09-15 Thread Tobiah
On 09/15/2017 09:25 AM, Stefan Ram wrote:> Tobiah writes: >> Modules can import other modules. It is customary but not >> required to place all import statements at the beginning >> of a module (or script, for that matter). The imported >> module na

Re: Question about modules documentation

2017-09-15 Thread Tobiah
>> 'next sentence' is the operative piece. I think that if the bit >> about placement was moved to the end of the paragraph the whole >> thing would be more readable and I wouldn't have stumbled on it. > > If it had meant "the imported module's names" or indeed "the imported > modules' names", I

Assertions

2017-09-21 Thread Tobiah
rned off with -O? Thanks, Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Creating a MIDI file

2017-10-04 Thread Tobiah
What would be the best library to use for creating MIDI files that I could import into a DAW like Reaper? Thanks, Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Sequence MIDI events from python.

2017-10-26 Thread Tobiah
er in python? I imagine I'd have to sync to an audio device to get the timing right. Thank for any help. Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: Sequence MIDI events from python. (Posting On Python-List Prohibited)

2017-10-26 Thread Tobiah
On 10/26/2017 4:30 PM, Lawrence D’Oliveiro wrote: On Friday, October 27, 2017 at 12:02:40 PM UTC+13, Tobiah wrote: I know that there are a few good MIDI libraries out there. The examples that I've seen for real-time triggering of events rely on a sleep function to realize the timing. Th

MySQLdb and conn.select_db()

2017-11-15 Thread Tobiah
yet my new machine is supporting it from the MySQLdb library. Are the docs lagging? Can I download the 'better' MySQLdb package and install it on the 8.04 machine? Thanks, Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: Changing calling sequence

2022-05-11 Thread Tobiah
On 5/11/22 06:33, Michael F. Stemper wrote: I have a function that I use to retrieve daily data from a home-brew database. Its calling sequence is; def TempsOneDay( year, month, date ): After using it (and its friends) for a few years, I've come to realize that there are times where it would be

Re: Which linux distro is more conducive for learning the Python programming language?

2022-08-04 Thread Tobiah
On 8/3/22 19:01, Turritopsis Dohrnii Teo En Ming wrote: Subject: Which linux distro is more conducive for learning the Python programming language? You might try Pythontu. Not really. Get the distro that looks appealing to you. One won't be better than the other with regard to learning pytho

UTF-8 and latin1

2022-08-17 Thread Tobiah
I get data from various sources; client emails, spreadsheets, and data from web applications. I find that I can do some_string.decode('latin1') to get unicode that I can use with xlsxwriter, or put in the header of a web page to display European characters correctly. But normally UTF-8 is recom

Re: UTF-8 and latin1

2022-08-17 Thread Tobiah
On 8/17/22 08:33, Stefan Ram wrote: Tobiah writes: I get data from various sources; client emails, spreadsheets, and data from web applications. I find that I can do some_string.decode('latin1') Strings have no "decode" method. ("bytes" objects do.) I&

Re: UTF-8 and latin1

2022-08-17 Thread Tobiah
That has already been decided, as much as it ever can be. UTF-8 is essentially always the correct encoding to use on output, and almost always the correct encoding to assume on input absent any explicit indication of another encoding. (e.g. the HTML "standard" says that all HTML files must be UTF-

Re: UTF-8 and latin1

2022-08-18 Thread Tobiah
Generally speaking browser submisisons were/are supposed to be sent using the same encoding as the page, so if you're sending the page as "latin1" then you'll see that a fair amount I should think. If you send it as "utf-8" then you'll get 100% utf-8 back. The only trick I know is to use . Woul

Re: UTF-8 and latin1

2022-08-18 Thread Tobiah
You configure the web server to send: Content-Type: text/html; charset=... in the HTTP header when it serves HTML files. So how does this break down? When a person enters Montréal, Quebéc into a form field, what are they doing on the keyboard to make that happen? As the string sits ther

Re: Passing information between modules

2022-11-18 Thread Tobiah
On 11/18/22 02:53, Stefan Ram wrote: Can I use "sys.argv" to pass information between modules as follows? in module A: import sys sys.argv.append( "Hi there!" ) in module B: import sys message = sys.argv[ -1 ] Kind of seems like a code smell. I think you would normally just inj

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Tobiah
On 1/20/23 07:29, Dino wrote: let's say I have this list of nested dicts: [   { "some_key": {'a':1, 'b':2}},   { "some_other_key": {'a':3, 'b':4}} ] I need to turn this into: [   { "value": "some_key", 'a':1, 'b':2},   { "value": "some_other_key", 'a':3, 'b':4} ] This doesn't look like

Re: Log File

2023-05-31 Thread Tobiah
On 5/31/23 00:22, ahsan iqbal wrote: Why we need a log file ? If i read a large text file than how log file help me in this regard? If you were parsing each line of this text file looking for information, perhaps some of the lines would not be formatted correctly, and you would be unable to g

Pandas or Numpy

2022-01-23 Thread Tobiah
I know very little about either. I need to handle score input files for Csound. Each line is a list of floating point values where each column has a particular meaning to the program. I need to compose large (hundreds, thousands, maybe millions) lists and be able to do math on, or possibly sort

Re: How to test input via subprocess.Popen with data from file

2022-03-11 Thread Tobiah
Why not just have scripts that echo out the various sets of test data you are interested in? That way, Popen would always be your interface and you wouldn't have to make two cases in the consumer script. In other words, make program that outputs test data just like your main data source program.

importing down in code rather than at top of file.

2016-08-29 Thread Tobiah
amount of processing power and memory to import a module, so it seems like I'd save those resources with the above pattern. The down side would be that it's nice to see all of the imports at the top which would follow convention. Should I care? Tobiah -- https://mail.python.org/mailma

Putting Unicode characters in JSON

2018-03-22 Thread Tobiah
I have some mailing information in a Mysql database that has characters from various other countries. The table says that it's using latin-1 encoding. I want to send this data out as JSON. So I'm just taking each datum and doing 'name'.decode('latin-1') and adding the resulting Unicode value ri

Re: Putting Unicode characters in JSON

2018-03-22 Thread Tobiah
On 03/22/2018 01:09 PM, Chris Angelico wrote: On Fri, Mar 23, 2018 at 6:46 AM, Tobiah wrote: I have some mailing information in a Mysql database that has characters from various other countries. The table says that it's using latin-1 encoding. I want to send this data out as JSON. S

Re: Putting Unicode characters in JSON

2018-03-23 Thread Tobiah
On 03/22/2018 12:46 PM, Tobiah wrote: I have some mailing information in a Mysql database that has characters from various other countries.  The table says that it's using latin-1 encoding.  I want to send this data out as JSON. So I'm just taking each datum and doing 'name&#

Re: ***URGENT CONTRACT OPPORTUNITY***

2018-03-28 Thread Tobiah
On 03/28/2018 06:45 AM, cagdenw...@gmail.com wrote: opportunity in Tours, France starting ASAP!!! and able to start ASAP!!! contact me ASAP When should I apply? -- https://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2018-04-03 Thread Tobiah
On 04/01/2018 11:31 PM, dlt.joaq...@gmail.com wrote: El miércoles, 28 de agosto de 2013, 21:18:26 (UTC-3), Mohsen Pahlevanzadeh escribió: Dear all, I'm C++ programmer and unfortunately put semicolon at end of my statements in python. Quesion: What's really defferences between putting semico

Re: semicolon at end of python's statements

2018-04-03 Thread Tobiah
On 04/03/2018 09:48 AM, kar...@gmail.com wrote: Semicolon is optional. If you put a semicolon at the end of the of a statement, you can keep writing statements. a=3;b=2 PyCharm still complains about two statements on one line and sites Pep 8. I never used to pay much attention to Pep 8, but

syntax oddities

2018-05-15 Thread Tobiah
Why is it len(object) instead of object.len? Why is it getattr(object, item) rather then object.getattr(item)? etc... Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: what does := means simply?

2018-05-17 Thread Tobiah
On 05/16/2018 08:54 PM, Steven D'Aprano wrote: On Thu, 17 May 2018 05:33:38 +0400, Abdur-Rahmaan Janhangeer wrote: what does := proposes to do? Simply, it proposes to add a new operator := for assignment (or binding) as an expression, as an addition to the = assignment operator which operates

Re: syntax oddities

2018-05-17 Thread Tobiah
Top posting is awesome for the reader plowing through a thread in order. In that case the cruft at the bottom is only for occasional reference. Ok, I yield! I know the bottom-posting party has congress right now. On 05/17/2018 06:29 AM, Grant Edwards wrote: On 2018-05-17, Abdur-Rahmaan Janhan

Re: why does list's .remove() does not return an object?

2018-05-17 Thread Tobiah
On 05/17/2018 09:25 AM, Ned Batchelder wrote: On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote: x = [0,1] x.remove(0) new_list = x Just call the original list 'new_list' to begin with. new_list = [0, 1] new_list.remove(0) There you are! -- https://mail.python.org/mailman/listinfo/pyt

Undocumented unescape() method in HTMLParser?

2018-05-25 Thread Tobiah
I came across its usage in StackOverflow somewhere, but didn't see it in the docs. I'm using 2.7. I needed it while writing a class for generating text documents out of HTML documents for attaching to emails, which lowers spam scores. I lifted the basis for this from the top answer here: https

Sorting and spaces.

2018-05-31 Thread Tobiah
>>> a = ['Awards', 'Award Winners'] >>> sorted(a) ['Award Winners', 'Awards'] So python evaluated the space as a lower ASCII value. Thoughts? Are there separate tools for alphabetizing rather then sorting? Thanks, Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Checking whether type is None

2018-07-24 Thread Tobiah
Consider: >>> type({}) is dict True >>> type(3) is int True >>> type(None) is None False Obvious I guess, since the type object is not None. So what would I compare type(None) to? >>> type(None) >>> type(None) is NoneType

MIDI note timing

2018-09-18 Thread Tobiah
I'd like to do some algorithmic composing using python. I've seen various libraries that seem to be capable of sending a MIDI message to a MIDI port, but I don't know where to get the timing from. Normally, with something like CSOUND, the program locks itself to the timing of the soundcard and pr

@staticmethod or def function()?

2018-10-31 Thread Tobiah
My IDE (pycharm) suggests that I mark my class methods with @staticmethod when they don't use 'self'. Sounds good. I did that then it suggested I had the option to make a regular function instead, at the file level. That's a possibility. I was thinking that I'd leave the method in the class unl

Re: Are all items in list the same?

2019-01-08 Thread Tobiah
On 1/8/19 9:20 AM, Alister wrote: On Tue, 08 Jan 2019 17:15:17 +, Alister wrote: On Tue, 08 Jan 2019 16:48:58 +0200, Serhiy Storchaka wrote: 08.01.19 11:07, Peter Otten пише: Bob van der Poel wrote: I need to see if all the items in my list are the same. I was using set() for this, but

Email blast management?

2019-01-09 Thread Tobiah
wn to recommendations on some good supporting libraries that will help me with any of these tasks. Thanks, Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: How to pass username and password in the curl requests using requests python module

2019-05-02 Thread Tobiah
On 5/2/19 4:30 AM, Pradeep Patra wrote: Can anyone pls help in this regard? Something like this?: requests.get('https://api.github.com/user', auth=('user', 'pass')) -- https://mail.python.org/mailman/listinfo/python-list

Handle foreign character web input

2019-06-28 Thread Tobiah
A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1? Does it depend on whether the name was cut and pasted from a Word doc. etc? Should I handle these internally as unicode? Right now my database tables are latin-1

Re: Handle foreign character web input

2019-06-28 Thread Tobiah
On 6/28/19 1:33 PM, Chris Angelico wrote:> On Sat, Jun 29, 2019 at 6:31 AM Tobiah wrote: A guy comes in and enters his last name as RÖnngren. So what did the browser really give me; is it encoded in some way, like latin-1? Does it depend on whether the name was cut and pasted from a W

itertools cycle() docs question

2019-08-21 Thread Tobiah
In the docs for itertools.cycle() there is a bit of equivalent code given: def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D ... saved = [] for element in iterable: yield element saved.append(element) while saved:

Re: itertools cycle() docs question

2019-08-21 Thread Tobiah
On 8/21/19 11:38 AM, Rob Gaddi wrote: On 8/21/19 11:27 AM, Tobiah wrote: In the docs for itertools.cycle() there is a bit of equivalent code given: def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D ... saved = [] for element in iterable: yield element saved.a

Re: How to remove a string from a txt file?

2019-09-04 Thread Tobiah
On 9/4/19 8:08 AM, Spencer Du wrote: Hi I want to remove a string from a txt file and then print out what I have removed. How do I do this. The txt file is in this format and should be kept in this format. txt.txt: laser,cameras, Thanks Do you want to remove one of the fields by using an

[OT(?)] Ubuntu 18 now defaults to 4-space tabs

2019-09-09 Thread Tobiah
We upgraded a server to 18.04 and now when I start typing a python file (seems to be triggered by the .py extension) the tabs default to 4 spaces. We have decades of code that use tab characters, and it has not been our intention to change that. I found a /usr/share/vim/vim80/indent/python.vim a

Re: [OT(?)] Ubuntu 18 vim now defaults to 4-space tabs

2019-09-10 Thread Tobiah
Your subject missed a critical word: vim. It's there! Run vim. Then ':set' to see what's set different than default. Then, if it is tabstop you want to know about, ':verbose set tabstop?' will tell you where that setting was last altered. Nothing that seems to point to space indent: backg

Re: [OT(?)] Ubuntu 18 vim now defaults to 4-space tabs

2019-09-10 Thread Tobiah
ended_style = 0 in my ~/.vimrc and my problem was elegantly solved. I continued here with the answer so that those that find my original post by Googling the same question would not be left hanging. Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Delay in python startup.

2019-09-30 Thread Tobiah
I don't have a lot of information, so here goes a shot in the dark. One day I started experiencing a delay when starting python. I'm on Ubuntu 16.04. It takes three seconds to get a prompt when I type 'python' on the command line (Python 2.7.12). When I run a script that imports packages, it t

Re: Hi how do I import files inside a txt file?

2019-09-30 Thread Tobiah
On 9/2/19 3:32 AM, Spencer Du wrote: Hi How do i import files inside a txt file if they exist in the current directory? Once you've read the module names you can use: new_module = __import__(modulename) So you'd read the name from your file into modulename and import the name contained in

Re: Delay in python startup.

2019-09-30 Thread Tobiah
On 9/30/19 9:54 AM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:56 AM Tobiah wrote: I don't have a lot of information, so here goes a shot in the dark. One day I started experiencing a delay when starting python. I'm on Ubuntu 16.04. It takes three seconds to get a prompt w

Odd delays when cwd is on a network mount

2019-10-11 Thread Tobiah
local/dir/not/on/mount/my_module.py When I do the same thing from my home directory there is no delay. $ wc -l /local/dir/not/on/mount/my_module.py 156 /local/dir/not/on/mount/my_module.py Thanks for any help. Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: Odd delays when cwd is on a network mount

2019-10-11 Thread Tobiah
On 10/11/19 10:56 AM, Tobiah wrote: I have a directory mounted with sshfs over a 5mb connection. It's quite usable under most circumstances. When I run python from a directory under that mount, imports from local directories are quite slow: $ python2.7 import my_module ## takes 25 se

Re: Odd delays when cwd is on a network mount

2019-10-14 Thread Tobiah
On 10/11/19 6:04 PM, Gregory Ewing wrote: Cameron Simpson wrote: Python's default sys.path includes the current working directory. Only in an interactive session, where it usually makes sense. I was only using the REPL for demonstration. The same delay happens when I import a module in a s

Re: 3rd party mail package

2019-12-18 Thread Tobiah
On 12/18/19 9:27 AM, Tobiah wrote: On 12/14/19 1:13 AM, Barry wrote: I guess the 2nd party is the user. I think of the user as the first party. 1) I want a thing for python. 2) Python doesn't have a very good one 3) Someone else will give it to you Wikipedia disagrees with me:

Re: 3rd party mail package

2019-12-18 Thread Tobiah
On 12/14/19 1:13 AM, Barry wrote: I guess the 2nd party is the user. I think of the user as the first party. 1) I want a thing for python. 2) Python doesn't have a very good one 3) Someone else will give it to you Barry On 13 Dec 2019, at 21:13, Abdur-Rahmaan Janhangeer wrote: Wond

Re: strptime for different languages

2019-12-18 Thread Tobiah
having to edit your code in a messy way. Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: 3rd party mail package

2019-12-18 Thread Tobiah
a business transaction.” I know. I admitted that the Wikipedia article disagreed with me, forcing me into a retraction of my previous assertion. I didn't post that link to reinforce my original argument. Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: strptime for different languages

2019-12-18 Thread Tobiah
t datetime would throw in this case. It crossed my mind when posting, but I was illustrating an idea rather than submitting usable code. 2. Why use 'continue' instead of 'pass'? No reason. Does one have a benefit over the other? Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: Font size

2005-02-24 Thread Tobiah
from random import randint rand = randint(0,36) print rand Don't forget about the double zero slot. Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Defining __getitem__() in a class that inherits from (dict)

2005-03-08 Thread Tobiah
27;] # OUTPUT: # None # None # None # Traceback (most recent call last): # File "", line 47, in ? # File "", line 36, in __getitem__ # File "", line 36, in __getitem__ # File "", line 36, in __getitem__ Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Defining __getitem__() in a class that inherits from (dict)

2005-03-08 Thread Tobiah
My appreciation for your responses is not easily imparted through text. Thank You. Steven Bethard wrote: Michael Hoffman wrote: Tobiah wrote: If within the __getitem__ method I attempt to get an item from self, the __getitem__ method is called in an infinite recursion. You need to explicitly use

Second argument to super().

2005-03-09 Thread Tobiah
What is the purpose of the second argument to super()? What is meant by the returning of an 'unbound' object when the argument is omitted. Also, when would I pass an object as the second argument, and when would I pass a type? Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk(entire filesystem)

2005-03-09 Thread Tobiah
When I do os.walk('/') on a Linux computer, the entire file system is walked. On windows, however, I can only walk one drive at a time (C:\, D:\, etc.). If this is a personal utility for one computer, and if you run XP on that computer, then you have the ability to mount secondary drives on to

How can I load a module when I will only know the name 'on the fly'

2005-03-14 Thread Tobiah
m = get_next_module() some_nice_function_somehow_loads( m ) Thanks, Tobiah -- http://mail.python.org/mailman/listinfo/python-list

Re: Question RE urllib

2013-12-17 Thread Tobiah
g/2.7/howto/urllib2.html#id6 It must be a network problem, cuz your code works fine: :w !python http://www.amazon.com/ http://google.com http://tobiah.org http://notavalidurl.com http://superreallyforsurenotavalidurlnokidding.com is down Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Python and MIDI

2013-12-17 Thread Tobiah
Is there a module out there that would let me send a predetermined list of midi messages to a MIDI device in such a way that the timing would be precise enough for music? Thanks, Tobiah -- https://mail.python.org/mailman/listinfo/python-list

Re: dictionary with tuples

2014-01-14 Thread Tobiah
On 01/14/2014 01:21 PM, YBM wrote: Le 14/01/2014 22:10, Igor Korot a écrit : Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more infor

Re: I am out of trial and error again Lists

2014-10-23 Thread Tobiah
On 10/22/2014 01:30 PM, Seymore4Head wrote: def nametonumber(name): lst=[""] for x,y in enumerate (name): lst=lst.append(y) print (lst) return (lst) a=["1-800-getcharter"] print (nametonumber(a))#18004382427837 The syntax for when to use a () and when to use [] stil

Re: (test) ? a:b

2014-10-24 Thread Tobiah
On 10/22/2014 01:29 AM, ast wrote: Hello Is there in Python something like: j = (j >= 10) ? 3 : j+1; as in C language ? thx Out of all of the replies, I don't think anyone actually offered the answer: a if condition else b -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   >