element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Rpi python problems
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 4 replies
  • Subscribers 666 subscribers
  • Views 417 views
  • Users 0 members are here
Related

Rpi python problems

realringer
realringer over 8 years ago

Hi,

Im currently working on a raspberry pi zero timelapse project. The idea is to have a rpi zero with a cameramodule conected to it. Also conected is a wifi module wich takes up the one usb port. I want to avoid getting a usb hub.

 

I got a button connected which is runned by a program. when the button is pressed it runs my main program.

My main concists of a loop which takes a picture every few minutes and uploads it to my dropbox acc wia the wifi connection.

 

The problem lies in when i dont have a screen or are shh into the pi. I have done some reserch and figured out that the comand im using to upload to dropbox and deleating the image does not work without the shell. I have tried to fix this but havent figured it out jet. Is there an other option for uploading it and deleating the image. Im locking for a option that does not require a shell but still works fine with my code. its a python progam.

 

Thx in advance!!

Christofer.image

  • Sign in to reply
  • Cancel
  • urkraft
    0 urkraft over 8 years ago

    What about installing the screen utility on the raspi and changing the setup to boot into your program in a screen session. If you do not already have the screen utility installed you can install it with the following commands:

    sudo apt-get install screen

    sudo reboot

    In order to change your setup to boot into a screen session running your program enter the following line just before the “exit 0” line in the rc.local file which is located in the “/etc”  folder:

    su – pi –c “screen –dm –S pistartup /home/pi/python_code/Timelapse.py”

     

    This assumes that your python program is “Timelapse.py” and is located in the “/home/pi/python_code” folder. If your program is dependent on other things which also need to be launched first (like for example the pigpiod utility) then you will also need to enter lines for launching these in the rc.local file. For example the line for launching the pigpiod utility is:

    su –c “pigpiod”

     

    Good luck!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • realringer
    0 realringer over 8 years ago in reply to urkraft

    Thanks for the answer!

     

    It seams to be a sulution. However i cant test it untill later this week. My pi zero ip adress seams to have changed since i last logged in. Weird because i had a static ip setted up. When i connect the micro sd with the os to a different pi i got the new ip address. But when i tried to shh again i failed to get contact with the zero using the new ip. I deffinetly need a bit of thinking and trial and error. Im quite buissy this week so it has to wait.

    Thanks though, i will get right on it when i have the time.

     

    Christofer

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • royleith
    0 royleith over 8 years ago

    I've always used the old os module. However, this link seems to have the answer,

     

    http://sharats.me/the-ever-useful-and-neat-subprocess-module.html

     

    You are using shell=true. It's used to get the enhanced features of the shell such as pipes. It does not look as though you are using shell features so use the shell=false mode.

     

    BTW the correct usage of shell=true is to use a string of the required shell command,

     

    call('ls -l', shell=True)

     

    It looks as though the syntax you are using is actually that of shell=false which requires a list of the program and arguments.

     

    call(['ls', '-l'])

     

    So, try

     

    call ([photofile])

    call ([photerm])

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • realringer
    0 realringer over 8 years ago in reply to royleith

    When i first encountered this problem i thought it had to do with the  shell=True . I therefore tried

    shell=False  aparently i was on the right track. But i didnt read the documentation and therefore it probebly were some faults. I got a errormessage when i tried it and moved on with other tries to fix it.

    Thanks for the link and im going to take a look at it when i get my rpi working again. I might just get my pi 3 and get the dropbox stuff sorted out tomorrow. Before i get into the ssh stuff and setting up the network again on the zero.

    Thanks again

     

    Christofer

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube