Re: Optparse buggy?

2011-09-01 Thread Jason Swails
dest='new') > Here you've imported parser as an alias to the OptionParser class. You can only use add_option() on an instance of that class. Try this: from optparse import OptionParser parser = OptionParser() parser.add_option('-n','--new',dest='ne

backwards-compatibility

2011-02-26 Thread Jason Swails
ny way of rewriting this so I can still print the error message in python2.5/2.4? Thanks! Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate 352-392-4032 -- http://mail.python.org/mailman/listinfo/python-list

Re: backwards-compatibility

2011-03-01 Thread Jason Swails
n2.6 and 2.7. > > Is there any way of rewriting this so I can still print the error message > in > > python2.5/2.4? > > <http://mail.python.org/mailman/listinfo/python-list> > Many Unix OSes (especially on supercomputers) have painfully out-of-date system python versions, so

Re: Get Path of current Script

2011-03-14 Thread Jason Swails
nstall directory location as part of the install process, which is done sometimes as well. This is easily accessible from python via os.environ['HOME'] or os.getenv('HOME') All the best, Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate

Re: Problems of Symbol Congestion in Computer Languages

2011-03-14 Thread Jason Swails
e can't possibly keep an unchanging system of measurement. Not to disagree with Steven, as these arguments are irrelevant in (almost all) current scientific research; just to pose thoughts. Food for thought, Jason -- http://mail.python.org/mailman/listinfo/python-list

multiprocessing Pool workers cannot create subprocesses

2011-03-18 Thread Jason Grout
It makes me nervous to just change the daemon status of the process like that, especially when I don't know the reason the workers have daemon=True to begin with. What is the reasoning behind that decision? What issues do we need to worry about if we just set the daemon mode flag like

Re: multiprocessing Pool workers cannot create subprocesses

2011-03-18 Thread Jason Grout
On 3/18/11 3:29 PM, Ned Deily wrote: In article<[email protected]>, Jason Grout wrote: The problem appears to be that multiprocessing sets its workers to have the daemon flag set to True, which prevents workers from creating child processes. If I uncomment the line ind

Re: multiprocessing Pool workers cannot create subprocesses

2011-03-19 Thread Jason Grout
On 3/19/11 4:17 PM, John L. Stephens wrote: On 3/18/2011 7:54 PM, Jason Grout wrote: Right; thanks. Let me rephrase my questions: 1. Why is important that the multiprocessing Pool worker processors have daemon=True (I think this is the same as asking: why is it important that they be

Re: dynamic assigments

2011-03-24 Thread Jason Swails
#x27;d rather do something like opts.variable than opts.dictionary['variable'] Just my 2c. Thanks to JM for suggesting setattr, btw. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting an array of string to array of float

2011-03-25 Thread Jason Swails
I'm guessing you have something like list1=['1.0', '2.3', '4.4', '5.5', ...], right? You can do this: for i in range(len(list1)): list1[i] = float(list1[i]) There's almost certainly a 1-liner you can use, but this should work. --Jason On F

Re: Some questions on pow and random

2011-03-27 Thread Jason Swails
algorithm, without going into much technical details is, > P0(x1,x2), P1(x1,x2) > > Now I am taking random.random() to generate both x1 and x2 and trying > to multiply them, is it fine? Or should I take anything else? > > I see no reason why you can't multiply them... I&#

Python program termination and exception catching

2011-04-10 Thread Jason Swails
y call that function, but then I fill up my script with trys and excepts which hurts readability (and makes the code uglier) and quashes tracebacks; neither of which I want to do. Any thoughts? Thanks! Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Python program termination and exception catching

2011-04-10 Thread Jason Swails
On Sun, Apr 10, 2011 at 12:34 PM, Laszlo Nagy wrote: > 2011.04.10. 21:25 keltezéssel, Jason Swails írta: > > Hello everyone, > > This may sound like a bit of a strange desire, but I want to change the > way in which a python program quits if an exception is not caught. The

Re: Python program termination and exception catching

2011-04-10 Thread Jason Swails
On Sun, Apr 10, 2011 at 4:49 PM, Jerry Hill wrote: > On Sun, Apr 10, 2011 at 3:25 PM, Jason Swails > wrote: > > > > Hello everyone, > > > > This may sound like a bit of a strange desire, but I want to change the > way in which a python program quits if an except

Re: Feature suggestion -- return if true

2011-04-11 Thread Jason Swails
; This is only true if n < 5. Otherwise, the first returns None and the second returns False. >>> def foo(n): ... x = n < 5 ... if x: return x ... >>> def foo1(n): ... return n < 5 ... >>> foo(4) True >>> foo1(4) True >>> foo(6) >>> foo1(6) False >>> --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: [Mac OSX] TextWrangler "run" command not working properly

2011-04-15 Thread Jason Swails
quaEnvVar.html Maybe if you prepend your Python 2.6 (MacPorts?) location to your PATH, it'll find it. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Egos, heartlessness, and limitations

2011-04-16 Thread Jason Swails
ave that much time for self-entertainment, but that would be pretty awesome (terrible?). --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Fibonacci series recursion error

2011-04-29 Thread Jason Friedman
> import os > def fib(n): >        if n == 1: >          return(n) >        else: >          return (fib(n-1)+fib(n-2)) > > list=fib(20) > print(list) > > The above function return the > return (fib(n-1)+fib(n-2)) > > > RuntimeError: maximum recursion depth exceeded in comparison > [36355 refs] > >

Re: Development tools and practices for Pythonistas

2011-05-01 Thread Jason Earl
buted VCS is good at supporting that, but in practice I went > back to my lightweight synchronization scripts and file storage > again. With the API, I could have best of both worlds. You should take a look at Bazaar. I found it fairly easy to use bzrlib from my own Python scripts. http:/

Re: Beginner needs advice

2011-05-29 Thread Jason Tackaberry
-- both connotatively and denotatively -- and to argue against the claim that Python 2 and 3 are "completely incompatible" it seems to me sufficient to provide a single non-trivial counter-example, which Steven has already done. Cheers, Jason. -- http://mail.python.org/mailman/listinfo/python-list

what exactly does type.__call__ do?

2017-11-01 Thread Jason Maldonis
Hi everyone, I want to use a metaclass to override how class instantiation works. I've done something analogous to using the Singleton metaclass from the Python3 Cookbook example. However, I want to provide a classmethod that allows for "normal" class instantiation that prevents this metaclass fr

Re: what exactly does type.__call__ do?

2017-11-01 Thread Jason Maldonis
(I'm using python3) @classmethod def normal_constructor(cls, *args, **kwargs): self = cls.__new__(cls) self.__init__(*args, **kwargs) return self On Wed, Nov 1, 2017 at 6:51 PM, Stefan Ram wrote: > Jason Maldonis writes: > >I was looking for documentation for what exac

Re: what exactly does type.__call__ do?

2017-11-01 Thread Jason Maldonis
Ok no worries then! Thanks for the tips. I might wait until tomorrow then until someone comes along who deals with metaclasses and alternate class constructors. In case you're curious, I'm doing two things that are relevant here, and I'll link the python3 cookbook examples that are super useful (I

Re: what exactly does type.__call__ do?

2017-11-02 Thread Jason Maldonis
choice -- for the reasons I listed above -- but I would like a more expert opinion (and I'd like to learn why :)). Thanks! Jason On Thu, Nov 2, 2017 at 12:28 AM, Steve D'Aprano wrote: > On Thu, 2 Nov 2017 10:13 am, Jason Maldonis wrote: > > > Hi everyone, > > &

why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
I was extending a `list` and am wondering why slicing lists will never raise an IndexError, even if the `slice.stop` value if greater than the list length. Quick example: my_list = [1, 2, 3] my_list[:100] # does not raise an IndexError, but instead returns the full list Is there any background

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
> > Have you ever used a language that does that? I have. > The String class in the C# language does that, and it's /really/ annoying. > I have to add extra code to prevent such exceptions. > In practice, I find that the way that Python does it is much nicer. (And > Python isn't unique in this res

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
>Why would this simplify your code? What are you doing that would benefit >from an IndexError here? Without simplifying too much, I'm writing a wrapper around a REST API. I want lazy-loading functionality for lists-of-things, so I am creating a LazyList class. This LazyList class will load items

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
> > This is explained in the Python tutorial for strings > https://docs.python.org/3/tutorial/introduction.html#strings, as a list > is a sequence just like a string it will act in exactly the same way. > The only relevant bit I found in that link is: "However, out of range slice indexes are hand

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
> > >> This is explained in the Python tutorial for strings > >> https://docs.python.org/3/tutorial/introduction.html#strings, as a list > >> is a sequence just like a string it will act in exactly the same way. > >> > > > > The only relevant bit I found in that link is: "However, out of range > >

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Jason Maldonis
I'll try to summarize what I've learned with a few responses in hodge-podge order and to no one in particular: >That's a feature dude, not a bug. Absolutely. I _do not_ think that how slicing works in python should be changed, but I _do_ want to understand its design decisions because it will mak

why won't slicing lists raise IndexError?

2017-12-08 Thread Jason Maldonis
I was extending a `list` and am wondering why slicing lists will never raise an IndexError, even if the `slice.stop` value if greater than the list length. Quick example: my_list = [1, 2, 3] my_list[:100] # does not raise an IndexError, but instead returns the full list Is there any background

Very strange issues with collections.Mapping

2018-01-18 Thread Jason Swails
these libraries is doing something naughty? Thanks! Jason -- Jason M. Swails -- https://mail.python.org/mailman/listinfo/python-list

Re: Sending Email using examples From Tutorials

2018-01-27 Thread Jason Friedman
> > import smtplib > server = smtplib.SMTP('localhost') > server.sendmail('[email protected]', > """To: [email protected] > From: [email protected] > > Beware the Ides of March. > """) > server.quit() > > when running this I get the following message. Please help: > > Traceback (most recent

Re: Any users of statistics.mode() here?

2018-02-20 Thread Jason Friedman
> statistics.mode() currently raises an exception if there is more than one > mode. > I am an infrequent user of this package and this function. My two cents: * Leave the current behavior as-is. * Continue to throw an exception for no data. * Add an argument, named perhaps mutli=False, that if se

Re: APPLICATION NOT RUNNING.

2018-03-02 Thread Jason Friedman
> > I try to run an application with the latest version of python that is > python 3.6.4 (32-bit) ., instead of running the application it only shows > feel free to mail [email protected] if you continue to encounter > issues,Please help me out thanks. > Hello, you might have more success if

Re: Python 3.11.0 installation and Tkinter does not work

2022-11-23 Thread Jason Friedman
> > I want learn python for 4 weeks and have problems, installing Tkinter. If > I installed 3.11.0 for my windows 8.1 from python.org and type > > >>> import _tkinter > > Traceback (most recent call last): > >File "", line 1, in > > ImportError: DLL load failed while importing _tkinter

Re: tksheet - Copy and Paste with headers

2023-04-16 Thread Jason Wang
在 2023/4/15 2:33, angela vales 写道: Hello All, I found this small group in a google search, so not sure if it is still active but giving it a try nonetheless. I have recently created a tkinter app and need the ability to copy and paste data from tksheet table into an Excel file. I do have a bu

Best practice for database connection

2023-05-31 Thread Jason Friedman
I'm trying to reconcile two best practices which seem to conflict. 1) Use a _with_ clause when connecting to a database so the connection is closed in case of premature exit. class_name = 'oracle.jdbc.OracleDriver' url = f"jdbc:oracle:thin:@//{host_name}:{port_number}/{database_name}" with jdbc.c

Re: For example: Question, moving a folder (T061RR7N1) containing a Specific file (ReadCMI), to folder: C:\\...\DUT0

2021-01-27 Thread Jason Friedman
> > > for path, dir, files in os.walk(myDestinationFolder): > # for path, dir, files in os.walk(destfolder): > print('The path is %s: ', path) > print(files) > os.chdir(mySourceFolder) > if not os.path.isfile(myDestinationFolder + file): > # if not os.path.isfile(destfolder + f

Re: What's the meaning the "backlog" in the socket.listen(backlog) is?

2021-02-16 Thread Jason Friedman
> > I set listen(2) and expect to see "error" when more clients than "the > maximum number of queued connections" trying to connect the server. But, no > error!! Even 4 clients can run normally without problem. > > Am I misunderstanding the meaning of this argument? > https://docs.python.org/3/lib

Determine what the calling program is

2021-04-18 Thread Jason Friedman
I should state at the start that I have a solution to my problem. I am writing to see if there is a better solution. I have a program that runs via crontab every five minutes. It polls a Box.com folder for files and, if any are found, it copies them locally and performs a computation on them that

Re: Set git config credential.helper cache and timeout via python

2021-12-11 Thread Jason Friedman
> Hey All, > > I have a set of bash and python scripts that all interact with a remote > git repository. > This does not exactly answer your question, but whenever I have wanted to interact with (popular) software via Python I have checked to see if someone has already written that code for me. h

Re: Set git config credential.helper cache and timeout via python

2021-12-11 Thread Jason Friedman
> > > Hey All, > > I have a set of bash and python scripts that all interact with a remote > git repository. > > > https://gitpython.readthedocs.io/en/stable/reference.html?highlight=cache#git.index.fun.read_cache > https://pypi.org/project/git-credential-helpers/ > > But neither means appears to h

multiprocessing.pool.Pool.map should take more than one iterable

2016-08-26 Thread ycm . jason
gnature to `Pool.map(function, iterable, ... [, chunksize])`. This will bring true equivalent to these functions. Tell me what you think. Pool.map: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.map map: https://docs.python.org/3/library/functions.html#map Jason

Stompy

2016-09-25 Thread Jason Friedman
My goal is to send messages to an AMQ server using Python 3.3. I found Stompy and performed 2to3-3.3 before building. I am open to non-Stompy solutions. My code: from stompy.stomp import Stomp my_stomp = Stomp(AMQ_HOST, AMQ_PORT) my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD) My error: Traceback

Re: Stompy

2016-09-25 Thread Jason Friedman
> > My error: >> Traceback (most recent call last): >> File "temp.py", line 8, in >> my_stomp.connect(AMQ_USERNAME, AMQ_PASSWORD) >> File "/lclapps/oppen/thirdparty/stompy/stomp.py", line 48, in connect >> self.frame.connect(self.sock, username=username, password=password, >> clientid=

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jason Friedman
> > for message in mailbox.mbox(sys.argv[1]): > if message.has_key("From") and message.has_key("To"): > addrs = message.get_all("From") > addrs.extend(message.get_all("To")) > for addr in addrs: > addrl = addr.lower() >

Re: passing a variable to cmd

2016-11-06 Thread Jason Friedman
> > import subprocess > import shlex > > domname = raw_input("Enter your domain name: "); > print "Your domain name is: ", domname > > print "\n" > > # cmd='dig @4.2.2.2 nbc.com ns +short' > cmd="dig @4.2.2.2 %s ns +short", % (domname) > proc=subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE

Re: Options for stdin and stdout when using pdb debugger

2016-11-25 Thread Jason Friedman
> I would like to use pdb in an application where it isn't possible to use > sys.stdin for input. I've read in the documentation for pdb.Pdb that a file > object can be used instead of sys.stdin. Unfortunately, I'm not clear about > my options for the file object. > > I've looked at rpdb on PyPI

List comprehension

2016-12-30 Thread Jason Friedman
$ python Python 3.6.0 (default, Dec 26 2016, 18:23:08) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> data = ( ... (1,2), ... (3,4), ... ) >>> [a for a in data] [(1, 2), (3, 4)] Now, this puzzles me: >>> [x,y for a in data] File "", line 1 [x

Re: List comprehension

2016-12-30 Thread Jason Friedman
> data = ( >> ... (1,2), >> ... (3,4), >> ... ) >> > [x,y for a in data] >> File "", line 1 >> [x,y for a in data] >>^ >> SyntaxError: invalid syntax >> >> I expected: >> [(1, 2), (3, 4)] > > > Why would you expect that? I would expect the global variables x and y, or > if

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Jason Friedman
On Tue, Mar 6, 2018 at 1:52 AM, Kirill Balunov wrote: > > I propose to delete all references in the `filter` documentation that the > first argument can be `None`, with possible depreciation of `None` as the > the first argument - FutureWarning in Python 3.8+ and deleting this option > in Python

Re: # of Months between two dates

2018-04-05 Thread Jason Friedman
> > > > I've written a function to return the months between date1 and date2 > but > > > I'd like to know if anyone is aware of anything in the standard library > > > to do the same? For bonus points, does anyone know if postgres can do > > > the same (we use a lot of date/time funcitons in postgr

Re: # of Months between two dates

2018-04-06 Thread Jason Friedman
> > >> > It's probably better to write the function yourself according to what > >> > makes sense in your use-case, and document its behaviour clearly. > >> > >> > > I suggest using the dateutil module ( > > https://pypi.python.org/pypi/python-dateutil) before writing your own. > > I'm not seeing a

Re: how to set timeout for os.popen

2018-04-15 Thread Jason Friedman
> > while 1: > runner = os.popen("tracert -d www.hello.com") > o=runner.read() > print(o) > runner.close() > runner = os.popen("tracert -d www.hello.com") > o=runner.read() > print(o) > runner.close() > runner = os.popen("tracert -d www.hello.com") > o=runner.read() > print(o) > runner.close() > >

defaultdict and datetime

2018-08-18 Thread Jason Friedman
$ python3 Python 3.6.1 (default, Apr 8 2017, 09:56:20) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import collections, datetime >>> x = collections.defaultdict(int) >>> x['something'] 0 >>> x = collections.defaultdict(datetime.datetime)

Re: Bottle framework references

2018-08-21 Thread Jason Friedman
> > I am building up the microsite based on Bottle framework now. > Any references/books? I am unfamiliar with this framework yet. > > I have used it with success. The online documentation was sufficient for my needs, at least. -- https://mail.python.org/mailman/listinfo/python-list

Re: Bottle framework references

2018-08-24 Thread Jason Friedman
> > > > On 22 Aug 2018, at 8:38 am, Jason Friedman wrote: > > > >> > >> I am building up the microsite based on Bottle framework now. > >> Any references/books? I am unfamiliar with this framework yet. > >> > >> I have used it with

Re: Add header at top with email.message

2018-09-15 Thread Jason Friedman
> > the EmailMessage class of email.message provides the methods > add_header() and __setitem__() to add a header to a message. > add_header() effectively calls __setitem__(), which does > `self._headers.append(self.policy.header_store_parse(name, val))`. This > inserts the header at the bottom. >

Re: namedtuples anamoly

2018-10-18 Thread Jason Friedman
> > So now the real question is: What were you trying to accomplish with > the assignment? Tell us, and let's see if we can find a way to > accomplish yor goal without wrecking the internals of the Grade class. > > And depending on your answer to that question, the new Data Classes feature in 3.7

Re: i cant seem to figure out the error

2016-04-03 Thread Jason Friedman
> >- Create a method called `withdraw` that takes in cash withdrawal amount >and updates the balance accordingly. if amount is greater than balance >return `"invalid transaction"` > > def withdraw(self, amount): > self.amount=amount > if(amount > self.balance): > return

Re: i cant seem to figure out the error

2016-04-03 Thread Jason Friedman
> def deposit(self, amount): > self.amount=amount > self.balance += amount > return self.balance > > > def withdraw(self, amount): > self.amount=amount > if(amount > self.balance): > return ("Amount greater than available balance.") > else: > self.balance -= amou

Re: Python,ping,csv

2016-04-09 Thread Jason Friedman
> for ping in range(1,254): > address = "10.24.59." + str(ping) > res = subprocess.call(['ping', '-c', '3', address]) > if res == 0: > print ("ping to", address, "OK") > elif res == 2: > print ("no response from", address) > else: > print ("ping to", addr

Re: Python,ping,csv

2016-04-11 Thread Jason Friedman
> I added a line. > I would need to put the output into a csv file which contained the results > of the hosts up and down. > Can you help me? > > > import subprocess > from ipaddress import IPv4Network > for address in IPv4Network('10.24.59.0/24').hosts(): > a = str(address) > res =

Re: Python,ping,csv

2016-04-11 Thread Jason Friedman
> I added a line. > I would need to put the output into a csv file which contained the > results of the hosts up and down. > Can you help me? > > import subprocess > from ipaddress import IPv4Network > for address in IPv4Network('10.24.59.0/24').hosts(): > a = str(address) > res = sub

The reason I uninstalled Python 3.5.1 (32-bit) for Windows

2016-04-12 Thread Jason Honeycutt
up at all. I'm going to try to download the 64-bit version and see if that helps. Kind Regards, Jason Honeycutt -- https://mail.python.org/mailman/listinfo/python-list

Re: Why online forums have bad behaviour (was: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?)

2016-05-12 Thread Jason Friedman
> TL;DR: because we're all human, and human behaviour needs either > immediate face-to-face feedback or social enforcement to correct > selfishness and abrasiveness. Where face-to-face feedback is lacking, > social enforcement needs to take more of the load. > > > Many people have a false sense of

Re: How can I debug silent failure - print no output

2016-05-27 Thread Jason Friedman
> > def GetArgs(): > '''parse XML from command line''' > parser = argparse.ArgumentParser() > > parser.add_argument("path", nargs="+") > parser.add_argument('-e', '--extension', default='', > help='File extension to filter by.') > args = parser.parse_args

Re: python parsing suggestion

2016-05-30 Thread Jason Friedman
> > Trying to extract the '1,1,114688:8192' pattern form the below output. > > pdb>stdout: > '3aae5d0-1: Parent Block for 1,1,19169280:8192 (block 1,1,114688:8192) > --\n3aae5d0-1: > magic 0xdeaff2fe mark_cookie > 0x\ngpal-3aae5d0-1: super.status > 3s

View committed code via gitpython

2016-07-01 Thread Jason Bailey
regex matching on it. Anyone savvy with this module that could steer me in the right direction??? Thanks Jason -- https://mail.python.org/mailman/listinfo/python-list

View committed code via gitpython

2016-07-01 Thread Jason Bailey
regex matching on it. Anyone savvy with this module that could steer me in the right direction??? Thanks Jason -- https://mail.python.org/mailman/listinfo/python-list

Re: Quick poll: gmean or geometric_mean

2016-07-09 Thread Jason Friedman
> > +1 for consistency, but I'm just fine with the short names. It's in the > statistics module after all, so the context is very narrow and clear and > people who don't know which to use or what the one does that they find in a > given piece of code will have to read the docs and maybe fresh up th

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Jason Benjamin
On Wed, 27 Jul 2016 17:25:43 -0400, Larry Martell wrote: > When I try and unpickle an object with pickle.loads it fails with: > > ImportError: Import by filename is not supported when unpickleing > > I've never used pickle before. Why do I get this and how can I fix it? Try using *pickle.load*

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread Jason Benjamin
On Wed, 27 Jul 2016 13:18:16 -0700, huey.y.jiang wrote: > Hi Folks, > > It is common to put a BUTTON on a canvas by the means of coding. > However, in my application, I need to draw a circle on canvas, and then > make this circle to work as if it is a button. When the circle is > clicked, it trig

Re: Is Activestate's Python recipes broken?

2016-08-04 Thread Jason Friedman
> > Log in to Activestate: > > https://code.activestate.com/recipes/langs/python/new/ > > and click "Add a Recipe". I get > > > Forbidden > > You don't have permission to access /recipes/add/ on this server. > Apache Server at code.activestate.com Port 443 > > > > Broken for everyone, or just for m

Re: Python Packages Survey

2019-01-19 Thread Jason Friedman
On Fri, Jan 18, 2019 at 5:22 PM Cameron Davidson-Pilon < [email protected]> wrote: > Hello! I invite you to participate in the Python Packages Survey - it takes > less than a minute to complete, and will help open source developers > understand their users' better. Thanks for participat

Re: Not Defined error in basic code

2019-03-14 Thread Jason Friedman
On Thu, Mar 14, 2019 at 8:07 AM Jack Dangler wrote: > > > class weapon: > weaponId > manufacturerName > > def printWeaponInfo(self): > infoString = "ID: %d Mfg: %s Model: %s" % (self.weaponId, > self.manufacturerName) > return infoString > > > > import class_wea

Re: The Mailing List Digest Project

2019-03-27 Thread Jason Friedman
On Mon, Mar 25, 2019 at 11:03 PM Abdur-Rahmaan Janhangeer < [email protected]> wrote: > As proposed on python-ideas, i setup a repo to turn mail threads into > articles. > > i included a script to build .md to .html (with syntax highlighting) here > is the index > > https://abdur-rahmaanj.githu

Re: The Mailing List Digest Project

2019-03-29 Thread Jason Friedman
> > Pretty cool. FYI, the index page (now containing 4 articles) with Google >> Chrome 72.0.3626.x prompts me to translate to French. The articles >> themselves do not. >> > > I'm now getting the translation offer on other web pages with Chrome, not just this one. Thus, please ignore my prior po

Re: How to use regex to search string between {}?

2019-08-28 Thread Jason Friedman
> > If I have path: /home/admin/hello/yo/{h1,h2,h3,h4} > > import re > r = re.search('{.}', path) > # r should be ['h1,h2,h3,h4'] but I fail > > Why always search nothing? > A site like http://www.pyregex.com/ allows you to check your regex with slightly fewer clicks and keystrokes than editing yo

fileinput module not yielding expected results

2019-09-07 Thread Jason Friedman
ne: {fileinput.isfirstline()}") I run this: $ python3 program.py ~/Section*.csv > ~/result I get this: $ grep "^Version" ~/result Version: sys.version_info(major=3, minor=7, micro=1, releaselevel='final', serial=0) $ grep "^Files" ~/result Files: ['/home

Re: fileinput module not yielding expected results

2019-09-07 Thread Jason Friedman
> > If you're certain that the headers are the same in each file, > then there's no harm and much simplicity in reading them each > time they come up. > > with fileinput ...: > for line in f: > if fileinput.isfirstline(): > headers = extract_headers(line)

Re: Congratulations to @Chris

2019-10-26 Thread Jason Friedman
> > Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner > http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html > > ...and for the many assistances and pearls of wisdom he has contributed > 'here'! > -- > Regards, > =dn > > Agreed. -- https://mail.python.org/mailman/

Re: Logistic Regression Define X and Y for Prediction

2019-11-13 Thread Jason Friedman
> > > When I define the X and Y values for prediction in the train and test > data, should I capture all the columns that has been "OneHotEncoded" (that > is all columns with 0 and 1) for the X and Y values??? > You might have better luck asking on Stackoverflow, per the Pandas instructions: https

Re: Grepping words for match in a file

2019-12-28 Thread Jason Friedman
> > > I have some lines in a text file like > ADD R1, R2 > ADD3 R4, R5, R6 > ADD.MOV R1, R2, [0x10] > Actually I want to get 2 matches. ADD R1, R2 and ADD.MOV R1, R2, [0x10] > because these two lines are actually "ADD" instructions. However, "ADD3" is > something else. > >>> s = """ADD R1, R

Re: TensorFlow with 3.8.1

2020-01-21 Thread Jason Friedman
You have another thread on this list that refers to general Python installation issues, so you'll need to work through that. I'm writing in this thread to say that tensorflow does not (today) support Python 3.8, you'll want to try 3.7, assuming that tensorflow is a critical piece for you: https://

Re: Consumer trait recognition

2020-05-04 Thread Jason Friedman
> > I constructed a lexicon for words that show how different words are linked > to consumer traits and motivations (e.g. Achievement and Power Motivation). > Now I have collected a large amount of online customer reviews and want to > match each review with the word definitions of the consumer tra

importlib: import X as Y; from A import B

2020-08-08 Thread Jason Friedman
I have some code I'm going to share with my team, many of whom are not yet familiar with Python. They may not have 3rd-party libraries such as pandas or selenium installed. Yes I can instruct them how to install, but the path of least resistance is to have my code to check for missing dependencies

Re: importlib: import X as Y; from A import B

2020-08-10 Thread Jason Friedman
> > import pandas; pd = pandas > > >df = pd.from_csv (...) > >from selenium import webdriver > > import selenium.webdriver; webdriver = selenium.webdriver > Thank you, this works. -- https://mail.python.org/mailman/listinfo/python-list

Re: MERGE SQL in cx_Oracle executemany

2020-10-17 Thread Jason Friedman
> > I'm looking to insert values into an oracle table (my_table) using the > query below. The insert query works when the PROJECT is not NULL/empty > (""). However when PROJECT is an empty string(''), the query creates a new > duplicate row every time the code is executed (with project value > popu

try/except in loop

2020-11-27 Thread Jason Friedman
I'm using the Box API (https://developer.box.com/guides/tooling/sdks/python/). I can get an access token, though it expires after a certain amount of time. My plan is to store the access token on the filesystem and use it until it expires, then fetch a new one. In the example below assume I have an

Re: try/except in loop

2020-11-27 Thread Jason Friedman
> > >> I'm using the Box API ( >> https://developer.box.com/guides/tooling/sdks/python/). >> I can get an access token, though it expires after a certain amount of >> time. My plan is to store the access token on the filesystem and use it >> until it expires, then fetch a new one. In the example be

filtering out warnings

2020-11-27 Thread Jason Friedman
The Box API is noisy ... very helpful for diagnosing, and yet for production code I'd like less noise. I tried this: warnings.filterwarnings( action='ignore', # category=Warning, # module=r'boxsdk.*' ) but I still see this: WARNING:boxsdk.network.default_network:"POST https://api.bo

Re: filtering out warnings

2020-11-29 Thread Jason Friedman
> > The Box API is noisy ... very helpful for diagnosing, and yet for > production code I'd like less noise. > > I tried this: > > warnings.filterwarnings( > action='ignore', > # category=Warning, > # module=r'boxsdk.*' > ) > > but I still see this: > > WARNING:boxsdk.network.default_ne

Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
t_file: reader = csv.DictReader(text_file) for row in reader: print(row) Getting this error: Traceback (most recent call last): File "/home/jason/my_box.py", line 278, in with io.TextIOWrapper(source_file.content(), encoding='utf-8') as text_file: AttributeError: 'bytes'

Re: Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
> > csv.DictReader appears to be happy with a list of strings representing > the lines. > > Try this: > > contents = source_file.content() > > for row in csv.DictReader(contents.decode('utf-8').splitlines()): > print(row) > Works great, thank you! Question ... will this form potentially use l

Re: Copying column values up based on other column values

2021-01-03 Thread Jason Friedman
> > import numpy as np > import pandas as pd > from numpy.random import randn > df=pd.DataFrame(randn(5,4),['A','B','C','D','E'],['W','X','Y','Z']) > > W X Y Z > A -0.183141 -0.398652 0.909746 0.332105 > B -0.587611 -2.046930 1.446886 0.167606 > C 1.142661 -0.861617 -0.180631 1.650463 > D 1.174805

Re: Problem splitting a string

2005-10-14 Thread Jason Stitt
but this gave me:['this_NP is_VL funny_JJ']Try re.split, as in:import rere.split('_| ', mystr)-Jason-- http://mail.python.org/mailman/listinfo/python-list

Re: UI toolkits for Python

2005-10-17 Thread Jason Stitt
many purposes. HTML is often "good enough" in a lot less time. But if we get to the point where browsers are implementing inter-page drag-and-drop (probably differently!) and so forth, some of us might well decide it's simpler to go back to wxPython, etc. Then again, m

Upper/lowercase regex matching in unicode

2005-10-19 Thread Jason Stitt
cs. Maybe I'm getting it mixed up with Perl regexen. The upper() and lower() methods do work on accented characters in a unicode string, so there has to be some recognition of unicode case in there somewhere. Thanks, Jason -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >