ANN: Wing IDE 5.0.9 released

2014-09-11 Thread Wingware

Hi,

Wingware has released version 5.0.9 of Wing IDE, our cross-platform 
integrated development environment for the Python programming language.


Wing IDE includes a professional quality code editor with vi, emacs, 
visual studio, and other key bindings, auto-completion, call tips, 
goto-definition, find uses, refactoring, context-aware auto-editing, a 
powerful graphical debugger, version control, unit testing, search, and 
many other features.  For details see http://wingware.com/


Changes in this minor release include:

Ability to mark a range of code in the editor for easy reevaluation 
in the Python Shell or Debug Probe

Optimized multi-file searching
Improved goto-definition in the Python Shell and Debug Probe
Preliminary support for OS X 10.10 (Yosemite)
Several VI mode fixes
Improved visit history
Fixed crashing on some mako files
Recursively copy directories dragged and dropped in the Project tool
Fix problems with typing into block selections
About 24 other improvements; see the change log for details

For details see http://wingware.com/pub/wingide/5.0.9/CHANGELOG.txt

A summary of new features in Wing 5:

Native GUI on OS X and better overall OS-native look and feel
Draggable tools and editors
Configurable toolbar and editor & project context menus
Lockable editor splits and mode to open different files in each split
Sharable color palettes and syntax highlighting configurations
Auto-editing is on by default (except some operations that have a 
learning curve)
Optional Python Turbo completion (context-appropriate completion on 
all non-symbol keys)
Improved Source Assistant with PEP 287 docstring rendering and 
return types

Move debug program counter
Named file sets
New Project dialog
Sharable launch configurations and named entry points
Asynchronous I/O in Debug Probe and Python Shell
More control over unit testing environment
Initial preferences dialog for new users
Support for Python 3.4 and Stackless Python 2.7 and 3.3
Support for Django 1.6
Support for matplotlib on Anaconda and with MacOSX backend
Support for Maya 2015, MotionBuilder 2015, Nuke 8, and Source Filmmaker
Improved integrated and PDF documentation
Expanded and rewritten tutorial
Multiple selections
Debug stepping by physical line, statement, and block
Mark active range in editor for Python Shell and Debug Probe

For more information on what's new in Wing 5, see 
http://wingware.com/wingide/whatsnew


Free trial: http://wingware.com/wingide/trial
Downloads: http://wingware.com/downloads
Feature list: http://wingware.com/wingide/features
Sales: http://wingware.com/store/purchase
Upgrades: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at [email protected].

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com


--
https://mail.python.org/mailman/listinfo/python-list


Re: Newer Debian versions of python on older Debian distros?

2014-09-11 Thread Travis Griggs
On Sep 8, 2014, at 5:06 PM, Chris Angelico  wrote:

> Alternatively, you could just run Debian Jessie. I have a few Jessie
> systems on the network, with a Python 3.4 IIRC, and there've been no
> stability problems lately. Both options are pretty easy.

In the end, we were able to get jessie running on this little board (it’s an 
Atmel Xplained SAMA5D3 which boasts one of the lowest linux power 
consumptions). And that solved our problems.
-- 
https://mail.python.org/mailman/listinfo/python-list


Example of python service running under systemd?

2014-09-11 Thread Travis Griggs
I’ve been reading lots of systemd docs. And blogs. Etc. At this point, I think 
I would benefit from learning by example…

Does anyone have an example .service file that they use to launch a long 
running service written as a python program?

If there is any example of what you changed to your python program itself, that 
to would be really instructional for me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Chris “Kwpolska” Warrick
On Thu, Sep 11, 2014 at 7:48 PM, Travis Griggs  wrote:
> I’ve been reading lots of systemd docs. And blogs. Etc. At this point, I 
> think I would benefit from learning by example…
>
> Does anyone have an example .service file that they use to launch a long 
> running service written as a python program?
>
> If there is any example of what you changed to your python program itself, 
> that to would be really instructional for me.
> --
> https://mail.python.org/mailman/listinfo/python-list

Depends what you want.  If you are running a Python web app, you can
use uWSGI Emperor, which plugs into systemd nicely and provides a
.service file in the docs (which also ships with the Arch Linux
package).  Otherwise, there are various ways, and this all depends on
how you structure this and your needs.  Use Type=simple and you won’t
need any changes to your program, or use one of the more magical
methods and implement them.  Describe your needs to get more details.
-- 
Chris “Kwpolska” Warrick 
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to create python web framework for ERP

2014-09-11 Thread Vimal Rughani
On Tuesday, 9 September 2014 13:55:24 UTC+5:30, Vimal Rughani  wrote:
> Hi All,
> 
> 
> 
> Greetings !
> 
> 
> 
> I am bit familiar with Django and Python. I want to create ERP on python. 
> Initially I feel Django will be good option for My Own ERP, but after working 
> bit on that I feel it doesn't fit with my requirement. So I decided to create 
> my own python based web framework for ERP. Can you please suggest me better 
> book / video / resources / content which help me to build proper web 
> framework for ERP.
> 
> 
> 
> Thanks

Thanks to all for your kind support. I looking into different suggestions given 
by you. Thanks again for your time
-- 
https://mail.python.org/mailman/listinfo/python-list


Thread-ID - how much could be?

2014-09-11 Thread Ervin Hegedüs
Hello,

I've made a long-time running daemon, which uses threads. Looks
like that works perfectly, now I'm looking at the exceptions :).

In the log, I found an interesting message:

Exception in thread Thread-82:
...

The main function allows 2 thread to run simultaniously, and if
the thread finished, then it joined with th.join(), where the
"th" is the thread item, derived from threading.Thread class.

My question is: how much thread ID could be totally? Is there any
maximum number? And if the thread reached that, what will be
done? Overlflowed? Couting from 0 again?


Thanks,


a.


-- 
I � UTF-8
-- 
https://mail.python.org/mailman/listinfo/python-list


Problem Installing Python

2014-09-11 Thread osemen tosin
Hi there,

I tried installing Python and I could not continue without getting this error. 

"There is a problem with this installer package. A DLL required for this 
install to complete could not be run. Contact your support personnel or vendor 
package."

Please I need your help.-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Peter Otten
Ervin Hegedüs wrote:

> I've made a long-time running daemon, which uses threads. Looks
> like that works perfectly, now I'm looking at the exceptions :).
> 
> In the log, I found an interesting message:
> 
> Exception in thread Thread-82:
> ...
> 
> The main function allows 2 thread to run simultaniously, and if
> the thread finished, then it joined with th.join(), where the
> "th" is the thread item, derived from threading.Thread class.
> 
> My question is: how much thread ID could be totally? Is there any
> maximum number? And if the thread reached that, what will be
> done? Overlflowed? Couting from 0 again?

A quick peak into threading.py reveals

# Helper to generate new thread names
_counter = 0
def _newname(template="Thread-%d"):
global _counter
_counter += 1
return template % _counter

class Thread:
...
def __init__(self, group=None, target=None, name=None,
 args=(), kwargs=None, *, daemon=None):
...
self._name = str(name or _newname())


There is no upper limit to the thread name other than that you will 
eventually run out of memory ;)


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Travis Griggs

On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick  
wrote:

> Depends what you want. 

Mine is not a web service. My main.py looks like this:

#!/usr/bin/env python3

import cycle
import pushTelemetry
from threading import Thread

def main():
Thread(target=pushTelemetry.udpLoop).start()
Thread(target=cycle.cycleLoop).start()

if __name__ == '__main__':
main()

It basically creates two threads, one which does some local processing and 
control, the other which periodically does reporting via udp packets. I use the 
dual threads because they both work with a shared serial port at times, so I 
have to synchronize access through that.

What I want is to have this startup, after my board has it’s networking layer 
up and running (and hopefully a valid ip address by then), and to just keep 
running forever
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Ervin Hegedüs
Hi Travis,

On Thu, Sep 11, 2014 at 02:06:48PM -0700, Travis Griggs wrote:
> 
> On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick  
> wrote:
> 
> > Depends what you want. 
> 
> Mine is not a web service. My main.py looks like this:
> 
> #!/usr/bin/env python3
> 
> import cycle
> import pushTelemetry
> from threading import Thread
> 
> def main():
> Thread(target=pushTelemetry.udpLoop).start()
> Thread(target=cycle.cycleLoop).start()
> 
> if __name__ == '__main__':
> main()
> 
> It basically creates two threads, one which does some local processing and 
> control, the other which periodically does reporting via udp packets. I use 
> the dual threads because they both work with a shared serial port at times, 
> so I have to synchronize access through that.
> 
> What I want is to have this startup, after my board has it’s networking layer 
> up and running (and hopefully a valid ip address by then), and to just keep 
> running forever

may be you think about the fork(), eg:

if __name__ == "__main__":
...other codes, eg. drop root privileges, ...
...check arguments...
try:
  pid = os.fork()
  if pid > 0:
  #print "Daemon started (pid: %d)" % (pid)
  sys.exit(0)
except OSError, e:
  print >>sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror)
  sys.exit(1)

os.chdir("/")
os.setsid()
os.umask(0)

# do second fork
try:
  pid = os.fork()
  if pid > 0:
  #print "Daemon started (pid: %d)" % (pid)
  sys.exit(0)
except OSError, e:
  print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror)
  sys.exit(1)

main()




regards,


a.

-- 
I � UTF-8
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Ervin Hegedüs
Hi Peter,

thanks for the reply,

On Thu, Sep 11, 2014 at 09:48:18PM +0200, Peter Otten wrote:
> Ervin Hegedüs wrote:
> 
> > Exception in thread Thread-82:
> > ...
> > My question is: how much thread ID could be totally? Is there any
> > maximum number? And if the thread reached that, what will be
> > done? Overlflowed? Couting from 0 again?
> 
> A quick peak into threading.py reveals
> 
> # Helper to generate new thread names
> _counter = 0
> def _newname(template="Thread-%d"):
> global _counter
> _counter += 1
> return template % _counter
> 
> class Thread:
> ...
> def __init__(self, group=None, target=None, name=None,
>  args=(), kwargs=None, *, daemon=None):
> ...
> self._name = str(name or _newname())
> 
> 
> There is no upper limit to the thread name other than that you will 
> eventually run out of memory ;)

thanks - I hope that the memory will not run out by these
threads... :)

Anyway, that means, on my system:

>>> import sys
>>> print sys.maxint
9223372036854775807

the couter could be 9223372036854775807?

And after? :)


Thanks,


a.



 

-- 
I � UTF-8
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Peter Otten
Ervin Hegedüs wrote:

> Hi Peter,
> 
> thanks for the reply,
> 
> On Thu, Sep 11, 2014 at 09:48:18PM +0200, Peter Otten wrote:
>> Ervin Hegedüs wrote:
>> 
>> > Exception in thread Thread-82:
>> > ...
>> > My question is: how much thread ID could be totally? Is there any
>> > maximum number? And if the thread reached that, what will be
>> > done? Overlflowed? Couting from 0 again?
>> 
>> A quick peak into threading.py reveals
>> 
>> # Helper to generate new thread names
>> _counter = 0
>> def _newname(template="Thread-%d"):
>> global _counter
>> _counter += 1
>> return template % _counter
>> 
>> class Thread:
>> ...
>> def __init__(self, group=None, target=None, name=None,
>>  args=(), kwargs=None, *, daemon=None):
>> ...
>> self._name = str(name or _newname())
>> 
>> 
>> There is no upper limit to the thread name other than that you will
>> eventually run out of memory ;)
> 
> thanks - I hope that the memory will not run out by these
> threads... :)
> 
> Anyway, that means, on my system:
> 
 import sys
 print sys.maxint
> 9223372036854775807
> 
> the couter could be 9223372036854775807?
> 
> And after? :)

Try it!

>>> print sys.maxint + 1
9223372036854775808

When you start one thread per second

>>> sys.maxint / (60*60 * 24 * 365.25)
292271023045.3132

after less than 300 billion years the only thing that will change is the 
type:

>>> type(sys.maxint)

>>> type(sys.maxint + 1)



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem Installing Python

2014-09-11 Thread Emile van Sebille

On 9/11/2014 12:31 PM, osemen tosin wrote:

Hi there,

I tried installing Python and I could not continue without getting this
error.

"There is a problem with this installer package. A DLL required for this
install to complete could not be run. Contact your support personnel or
vendor package."

Please I need your help.


Well, I suspect you're on windows, so I'd recommend you download and 
install the appropriate activestate distribution of python.  See


http://www.activestate.com/activepython/downloads

Emile


--
https://mail.python.org/mailman/listinfo/python-list


Re: Problem Installing Python

2014-09-11 Thread Terry Reedy

On 9/11/2014 3:31 PM, osemen tosin wrote:

Hi there,

I tried installing Python and I could not continue without getting this
error.

"There is a problem with this installer package. A DLL required for this
install to complete could not be run. Contact your support personnel or
vendor package."


Which version of Windows?
Which version of Python?
Did you try re-downloading?
Are any versions already installed?
Do they run?
What *exactly* did you do?
What happened before the error occurred?
Did you run as admin or get the permission box?

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Travis Griggs

On Sep 11, 2014, at 2:29 PM, Ervin Hegedüs  wrote:

> Hi Travis,
> 
> On Thu, Sep 11, 2014 at 02:06:48PM -0700, Travis Griggs wrote:
>> 
>> On Sep 11, 2014, at 11:18 AM, Chris “Kwpolska” Warrick  
>> wrote:
>> 
>>> Depends what you want. 
>> 
>> Mine is not a web service. My main.py looks like this:
>> 
>> #!/usr/bin/env python3
>> 
>> import cycle
>> import pushTelemetry
>> from threading import Thread
>> 
>> def main():
>>Thread(target=pushTelemetry.udpLoop).start()
>>Thread(target=cycle.cycleLoop).start()
>> 
>> if __name__ == '__main__':
>>main()
>> 
>> It basically creates two threads, one which does some local processing and 
>> control, the other which periodically does reporting via udp packets. I use 
>> the dual threads because they both work with a shared serial port at times, 
>> so I have to synchronize access through that.
>> 
>> What I want is to have this startup, after my board has it’s networking 
>> layer up and running (and hopefully a valid ip address by then), and to just 
>> keep running forever
> 
> may be you think about the fork(), eg:
> 
> if __name__ == "__main__":
>...other codes, eg. drop root privileges, ...
>...check arguments...
>try:
>  pid = os.fork()
>  if pid > 0:
>  #print "Daemon started (pid: %d)" % (pid)
>  sys.exit(0)
>except OSError, e:
>  print >>sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror)
>  sys.exit(1)
> 
>os.chdir("/")
>os.setsid()
>os.umask(0)
> 
># do second fork
>try:
>  pid = os.fork()
>  if pid > 0:
>  #print "Daemon started (pid: %d)" % (pid)
>  sys.exit(0)
>except OSError, e:
>  print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror)
>  sys.exit(1)
> 
>main()

OK, I’m probably going to show my naivety about something simple here…

I thought a “fork” essentially created a memory copy of the original process 
and let it go off running. The problem is, in the bowels of the code executing 
in those loops, I access a single instance of a threading.RLock, so that I can 
avoid both threads trying to do transactions with a single serial port at the 
same time. If I end up with two copies of the base process, unhooked from their 
parent, does that RLock still remain valid between the two? I thought since 
they were complete different copies of the same memory, they would no longer be 
coordinated.

Is this a day where I discover something new?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Chris Angelico
On Fri, Sep 12, 2014 at 3:48 AM, Travis Griggs  wrote:
> I’ve been reading lots of systemd docs. And blogs. Etc. At this point, I 
> think I would benefit from learning by example…
>
> Does anyone have an example .service file that they use to launch a long 
> running service written as a python program?
>
> If there is any example of what you changed to your python program itself, 
> that to would be really instructional for me.

Yeah, I did that for the Yosemite Project:

https://github.com/Rosuav/Yosemite

The main program is Python, but all the systemd code comes from a Pike
script that creates a bash script that creates the systemd file. Yes,
that's a little convoluted... Here's the relevant shell script part,
in case you don't want to dig it out of auth.pike:


#!/bin/bash
[ "$1" = "install" ] && [ -d /etc/systemd/system ] && {
echo "[Unit]
Description=Yosemite Project

[Service]
# The user, path, and X display are derived at installation time
# from the attributes of the yos script. Reinstall to reset them.
Environment=DISPLAY=$DISPLAY
User=`stat -c %u $0`
ExecStart=`readlink -e $0`
# If the network isn't available yet, restart until it is.
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
" >/etc/systemd/system/yos.service
# Note that some of this will fail if systemd is installed
# but isn't the default init system. In that case, well, you
# can't use this method of autostarting. TODO: Provide some
# other ways to autostart (eg for Upstart and/or sysvinit).
systemctl --system daemon-reload
systemctl enable yos.service
echo Installed as yos.service.
systemctl start yos.service
exit
}
# ... blah blah various setup
python Yosemite.py


This has some complications that you probably don't need, like that
the owner of the script should become the user that runs it (chances
are you can hard-code this, or run it as root and have it drop
privileges itself, or something), and it needs to restart on failure,
as it has to establish an sshfs mount before starting the main
program. But it's a start.

Note the three commands just before the script exits. Unlike sysvinit
and upstart, systemd needs to be told to reload service files, and
then you need to enable the service before it'll run on startup (and I
like to start it immediately, to see that it's working properly). Took
me a few hang-ups to figure that part out. Fortunately systemd can
notice and give a warning if you change files and don't daemon-reload
it; I'm not sure why it can't simply reload automatically (AIUI
Upstart uses inotify on /etc/init - no idea why systemd can't do the
same).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Steven D'Aprano
Ervin Hegedüs wrote:

[...]
>> > My question is: how much thread ID could be totally? Is there any
>> > maximum number? And if the thread reached that, what will be
>> > done? Overlflowed? Couting from 0 again?
[...]
>> There is no upper limit to the thread name other than that you will
>> eventually run out of memory ;)
> 
> thanks - I hope that the memory will not run out by these
> threads... :)
> 
> Anyway, that means, on my system:
> 
 import sys
 print sys.maxint
> 9223372036854775807
> 
> the couter could be 9223372036854775807?
> 
> And after? :)

Suppose you somehow managed to create 9223372036854775807 threads. If your
computer has 16 GB of RAM available, that means that at most each thread
can use:

py> 16*1024*1024*1024/9223372036854775807
1.862645149230957e-09

bytes. That's not allowing any memory for the rest of your program, the
Python interpreter, other processes, or the operating system. That is less
than a single bit and clearly is impossible. You will run out of memory
*long* before reaching 9223372036854775807 threads running at once.

Suppose you don't have all the threads running at once, but you create and
destroy the threads as quickly as possible, so there is never more than one
thread alive at a time (plus the main interpreter thread). Suppose you have
an extremely fast computer that can create and destroy a billion threads
per second, one thread per nanosecond. Then your program would need to run
for:

py> 9223372036854775807*1e-9/60/60/24/365
292.471208677536

years non-stop before reaching a count of sys.maxint. I know that some Linux
systems can have an uptime over a year, perhaps even two years, but I think
that nearly 300 years is asking a bit much. Your hardware probably won't
keep working that long.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Skip Montanaro
On Thu, Sep 11, 2014 at 8:29 PM, Steven D'Aprano
 wrote:
> Suppose you somehow managed to create 9223372036854775807 threads. If your
> computer has 16 GB of RAM available, that means that at most each thread
> can use:
>
> py> 16*1024*1024*1024/9223372036854775807
> 1.862645149230957e-09
>
> bytes.

Doesn't that calculation assume that they all have to be alive at the
same time? (Maybe I missed it in earlier posts, but I don't think the
OP indicated they'd have to all be active.)

That said, I think the OP should probably be worrying about other ways
his program could fail besides overflowing some nonexistent max thread
id. :-)

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Chris Angelico
On Fri, Sep 12, 2014 at 11:29 AM, Steven D'Aprano
 wrote:
> I know that some Linux
> systems can have an uptime over a year, perhaps even two years, but I think
> that nearly 300 years is asking a bit much. Your hardware probably won't
> keep working that long.

I've had over two years of uptime. Currently looking at 85 wk 4d
02:11:28 since the UPS and power failed simultaneously, but before
that, over two years.

But what about a 32-bit build? You could blow 1<<31 in about a month
of milliseconds, and I just tried, and on this 32-bit Windows box I
have here, I can start 10K threads in under a second:

>>> def test(n):
def f(): pass
start=time.time()
for i in range(n):
t=threading.Thread(target=f)
return (time.time()-start)/n
>>> test(1)
6.562459468841553e-05
>>> test(10)
6.906198978424073e-05

So if it's 7e-5 seconds per thread (65-69 microseconds), that'd be
less than two days to blow a 32-bit maxint. You could probably keep
even a Win 98 computer running that long!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Michael Torrie
On 09/11/2014 03:29 PM, Ervin Hegedüs wrote:
>> It basically creates two threads, one which does some local processing and 
>> control, the other which periodically does reporting via udp packets. I use 
>> the dual threads because they both work with a shared serial port at times, 
>> so I have to synchronize access through that.
>>
>> What I want is to have this startup, after my board has it’s networking 
>> layer up and running (and hopefully a valid ip address by then), and to just 
>> keep running forever
> 
> may be you think about the fork(), eg:

No, you you don't need to do this.  Systemd can handle all of that for
you.  Read up on the docs on creating systemd services.  Here's a little
blog post that has some good examples, both a non-daemonizing service
and a daemonizing service:

http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html

Any executable file can be turned into a daemon service with systemd
(whether or not it forks itself into the background).  Thus any python
script can easily be run from systemd.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Chris Angelico
On Fri, Sep 12, 2014 at 12:03 PM, Michael Torrie  wrote:
> No, you you don't need to do this.  Systemd can handle all of that for
> you.  Read up on the docs on creating systemd services.  Here's a little
> blog post that has some good examples, both a non-daemonizing service
> and a daemonizing service:
>
> http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html
>
> Any executable file can be turned into a daemon service with systemd
> (whether or not it forks itself into the background).  Thus any python
> script can easily be run from systemd.

I strongly recommend making a non-daemonizing service. It's so much
easier to debug - there's one mode of operation, the script just runs.
You can then run that directly in a terminal, or via tmux, or via
systemd - and I've done all three with Yosemite. In fact, I think I
have instances here on the LAN that are doing all three, right now!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Michael Torrie
On 09/11/2014 08:29 PM, Chris Angelico wrote:
> On Fri, Sep 12, 2014 at 12:03 PM, Michael Torrie  wrote:
>> No, you you don't need to do this.  Systemd can handle all of that for
>> you.  Read up on the docs on creating systemd services.  Here's a little
>> blog post that has some good examples, both a non-daemonizing service
>> and a daemonizing service:
>>
>> http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html
>>
>> Any executable file can be turned into a daemon service with systemd
>> (whether or not it forks itself into the background).  Thus any python
>> script can easily be run from systemd.
> 
> I strongly recommend making a non-daemonizing service. It's so much
> easier to debug - there's one mode of operation, the script just runs.
> You can then run that directly in a terminal, or via tmux, or via
> systemd - and I've done all three with Yosemite. In fact, I think I
> have instances here on the LAN that are doing all three, right now!

Agreed 100%.  If you want to run on a system without systemd, I
recommend using supervisord[1] for turning your program into a daemon.
It also does not require the app to fork.

[1] http://supervisord.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Why command os.popen works in python interactive mode but not in script debugger mode?

2014-09-11 Thread Viet Nguyen
Can anyone give me hint or reason why same command behaves differently in 
debugger mode from interactive mode:

>From interactive mode:

>>> import os
>>> p = os.popen('date')
>>> p.read()
'Thu Sep 11 11:18:07 PDT 2014\n'

But from debugger mode in a script:
>>> import os
(Pdb) p = os.popen('date')
*** SyntaxError: SyntaxError('invalid syntax', ('', 1, 1, "= 
os.popen('date')"))


Can anyone help me why there is syntax here?

Thanks,
Viet



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why command os.popen works in python interactive mode but not in script debugger mode?

2014-09-11 Thread Chris Angelico
On Fri, Sep 12, 2014 at 3:15 PM, Viet Nguyen
 wrote:
> But from debugger mode in a script:
 import os
> (Pdb) p = os.popen('date')
> *** SyntaxError: SyntaxError('invalid syntax', ('', 1, 1, "= 
> os.popen('date')"))
>
>
> Can anyone help me why there is syntax here?
>

This is actually a command to the debugger. You say "p
some_expression" and it prints out the value of some_expression.

https://docs.python.org/2/library/pdb.html#debugger-commands

Commands that the debugger doesn’t recognize are assumed to be Python
statements and are executed in the context of the program being
debugged. Python statements can also be prefixed with an exclamation
point (!).
"""

So try this:

!p = os.popen('date')

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Cameron Simpson

On 12Sep2014 11:29, Steven D'Aprano  
wrote:

[...]maxint. I know that some Linux
systems can have an uptime over a year, perhaps even two years, but I think
that nearly 300 years is asking a bit much.


2 years is nothing. Unless they have a particularly buggy kernel, most UNIX 
systems, Linux included, will stay up almost indefinitely. We've definitely had 
systems up for well over 2 years.



Your hardware probably won't
keep working that long.


300 years? Probably not. Regrettably.

Cheers,
Cameron Simpson 

We need a taxonomy for 'printing-that-is-no-longer-printing.'
- overhead by WIRED at the Intelligent Printing conference Oct2006
--
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Chris Angelico
On Fri, Sep 12, 2014 at 1:41 PM, Cameron Simpson  wrote:
> On 12Sep2014 11:29, Steven D'Aprano 
> wrote:
>>
>> [...]maxint. I know that some Linux
>> systems can have an uptime over a year, perhaps even two years, but I
>> think
>> that nearly 300 years is asking a bit much.
>
>
> 2 years is nothing. Unless they have a particularly buggy kernel, most UNIX
> systems, Linux included, will stay up almost indefinitely. We've definitely
> had systems up for well over 2 years.
>
>> Your hardware probably won't
>> keep working that long.
>
>
> 300 years? Probably not. Regrettably.

Once you get into the counting of years (rather than days), it's all
down to hardware. How long before that hardware needs an upgrade? Does
your incoming power have fail-overs? I don't currently have any
servers with multiple power supplies, so if anything like that goes
bung, my server's down. Doesn't matter how quickly I can bring up an
equivalent on a different hunk of hardware, the uptime's gone.

But yeah. 300 years? Good luck. I don't think anyone's ever going to hit that.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


pythonw.exe has stopped working

2014-09-11 Thread rahuldbhagat


Hello Folks,

I'm using RIDE -- Robot Framework Test Data Editor
RIDE 1.3 running on Python 2.7.6. 

When I click on some of my test case the RIDE GUI hangs and gives bellow error 
message.


[Window Title]
pythonw.exe

[Main Instruction]
pythonw.exe has stopped working

[Content]
A problem caused the program to stop working correctly. Windows will close the 
program and notify you if a solution is available.

[Close program]


It's strange that while it's able to open other test cases but fails on one 
particular test case. The distinguishing  fact about the test case is that it 
is a big one using lots of keywords.

I know it might work if I split my test case but have any of you encountered 
this problem and knows how to fix it ? some fix like providing more memory or 
specifying some parameter when pythonw.exe starts?


Thank you very much  in advance.

Cheers,

Rahul.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Ervin Hegedüs
Hi Michael,

On Thu, Sep 11, 2014 at 08:03:54PM -0600, Michael Torrie wrote:
> >> What I want is to have this startup, after my board has it’s networking 
> >> layer up and running (and hopefully a valid ip address by then), and to 
> >> just keep running forever
> > 
> > may be you think about the fork(), eg:
> 
> No, you you don't need to do this.  Systemd can handle all of that for
> you.  Read up on the docs on creating systemd services.  Here's a little
> blog post that has some good examples, both a non-daemonizing service
> and a daemonizing service:
> 
> http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html
> 
> Any executable file can be turned into a daemon service with systemd
> (whether or not it forks itself into the background).  Thus any python
> script can easily be run from systemd.

thanks a lot, I didn't hear about that feature.


Cheers,

Ervin

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Example of python service running under systemd?

2014-09-11 Thread Ervin Hegedüs
Hi Chris,

On Fri, Sep 12, 2014 at 12:29:27PM +1000, Chris Angelico wrote:
> On Fri, Sep 12, 2014 at 12:03 PM, Michael Torrie  wrote:
> >
> > Any executable file can be turned into a daemon service with systemd
> > (whether or not it forks itself into the background).  Thus any python
> > script can easily be run from systemd.
> 
> I strongly recommend making a non-daemonizing service. It's so much
> easier to debug - there's one mode of operation, the script just runs.
> You can then run that directly in a terminal, or via tmux, or via
> systemd - and I've done all three with Yosemite. In fact, I think I
> have instances here on the LAN that are doing all three, right now!

is there any other reason outside the debugging?

Of course, I've handled that in a simple way:

parser = optparse.OptionParser()

parser.add_option("-d",
  "--debug",
action="count",
dest="debug_mode",
help="Start process in debug mode, not forking.")

(options, args) = parser.parse_args()

debug_mode = True
if options.debug_mode is None:

debug_mode = False
try:
pid = os.fork()
if pid > 0:
   

And of course, I've handled the signals, logfiles and so on...

So, now I can run my app with -d, then it will not do the fork(),
I'll see all messages and feedbacks. Elsewhere, the process will
run in background.

Anyway, thanks all comments from others. May be the life is
easier with systemd, but that was my "5-minutes-finger-exercise"
:)


Thanks again,


a.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread-ID - how much could be?

2014-09-11 Thread Ervin Hegedüs
Hi Steven,

On Fri, Sep 12, 2014 at 11:29:56AM +1000, Steven D'Aprano wrote:
>  import sys
>  print sys.maxint
> > 9223372036854775807
> > 
> > the couter could be 9223372036854775807?
> > 
> > And after? :)
> 
> Suppose you somehow managed to create 9223372036854775807 threads. If your
> computer has 16 GB of RAM available, that means that at most each thread
> can use:

so, thanks for your and others answers - this was just a
_theoretical_ question. What is the practice - that's an another
thread. :)

I just simply interested about this theory, not more. I don't
care with-how-many-memories-needs-and-how-many-years-to-overflow
that counter, but many people calculates that - thanks :)


Cheers,


a.

-- 
https://mail.python.org/mailman/listinfo/python-list