Nikos,

It's possible that you need to explicitly include the pyserial module in your setup.py.  It may also require a workaround similar to this one for the PIL libraries:  http://www.py2exe.org/index.cgi/py2exeAndPIL -> figure out what pyserial is checking the string value 'loop://' against and import that constant in one of your modules to ensure that it gets bundled when you compile to exe.

Regards,
--Daniel


On Thu, Jul 10, 2014 at 3:21 PM, Nikos Koukis <nickkouk@gmail.com> wrote:
Hi!

My name is Nikos Koukis. 
I have developed a python script for serial communication with a digital pump as a project in my university. 
The script seems to run properly when run under python and when I try to convert it to .exe the procedure doesn’t raise any error.
However when running the produced .exe I have the following error message:
 
File: serial\__init__.pyc in line 71 in serial_for_url
ValueError: invalid URL protocol 'loop' not known
The relevant part of the code is the following:
    try:
        self.ser = serial.Serial(port = port_name,\
                baudrate = 9600,\
                parity = 'N',\
                stopbits = 1,\
                bytesize = 8,\
                timeout = self.timeout_time)
    except serial.SerialException:
        self.ser = serial.serial_for_url('loop://',\
              timeout = self.timeout_time) # This line BLOWS!
    except:
        print sys.exc_info()[0]

    finally:
        self.initialize_pump()

It seems that after the production of the .exe file, the serial.serial_for_url(‘loop://') line doesn’t work at all.
Is there any open issue on bugs when using pyserial and py2exe? 
Is there any workaround which I could use?

-- 
Nikos Koukis
School of Mechanical Engineering
National Technical University of Athens
nickkouk@gmail.com
+30 6979852969


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users